diff mbox series

xfs_repair: be more helpful if rtdev is not specified for rt subvol

Message ID ee05a000-4c9d-ad5d-66d0-48655cb69e95@redhat.com (mailing list archive)
State Deferred, archived
Headers show
Series xfs_repair: be more helpful if rtdev is not specified for rt subvol | expand

Commit Message

Eric Sandeen Sept. 30, 2020, 3:54 p.m. UTC
Today, if one tries to repair a filesystem with a realtime subvol but
forgets to specify the rtdev on the command line, the result sounds dire:

Phase 1 - find and verify superblock...
xfs_repair: filesystem has a realtime subvolume
xfs_repair: realtime device init failed
xfs_repair: cannot repair this filesystem.  Sorry.

We can be a bit more helpful, following the log device example:

Phase 1 - find and verify superblock...
This filesystem has a realtime subvolume.  Specify rt device with the -r option.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Comments

Eric Sandeen Sept. 30, 2020, 3:57 p.m. UTC | #1
On 9/30/20 10:54 AM, Eric Sandeen wrote:
> Today, if one tries to repair a filesystem with a realtime subvol but
> forgets to specify the rtdev on the command line, the result sounds dire:
> 
> Phase 1 - find and verify superblock...
> xfs_repair: filesystem has a realtime subvolume
> xfs_repair: realtime device init failed
> xfs_repair: cannot repair this filesystem.  Sorry.
> 
> We can be a bit more helpful, following the log device example:
> 
> Phase 1 - find and verify superblock...
> This filesystem has a realtime subvolume.  Specify rt device with the -r option.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---

Oops, no.  This is in core code not repair code, we can't make suggestions about
command line options here, sorry.

> diff --git a/libxfs/init.c b/libxfs/init.c
> index cb8967bc..65cc3d4c 100644
> --- a/libxfs/init.c
> +++ b/libxfs/init.c
> @@ -429,9 +429,9 @@ rtmount_init(
>  	if (sbp->sb_rblocks == 0)
>  		return 0;
>  	if (mp->m_rtdev_targp->dev == 0 && !(flags & LIBXFS_MOUNT_DEBUGGER)) {
> -		fprintf(stderr, _("%s: filesystem has a realtime subvolume\n"),
> -			progname);
> -		return -1;
> +		fprintf(stderr, _("This filesystem has a realtime subvolume.  "
> +			   "Specify rt device with the -r option.\n"));
> +		exit(1);
>  	}
>  	mp->m_rsumlevels = sbp->sb_rextslog + 1;
>  	mp->m_rsumsize =
>
Darrick J. Wong Sept. 30, 2020, 3:59 p.m. UTC | #2
On Wed, Sep 30, 2020 at 10:54:42AM -0500, Eric Sandeen wrote:
> Today, if one tries to repair a filesystem with a realtime subvol but
> forgets to specify the rtdev on the command line, the result sounds dire:
> 
> Phase 1 - find and verify superblock...
> xfs_repair: filesystem has a realtime subvolume
> xfs_repair: realtime device init failed
> xfs_repair: cannot repair this filesystem.  Sorry.
> 
> We can be a bit more helpful, following the log device example:
> 
> Phase 1 - find and verify superblock...
> This filesystem has a realtime subvolume.  Specify rt device with the -r option.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> diff --git a/libxfs/init.c b/libxfs/init.c
> index cb8967bc..65cc3d4c 100644
> --- a/libxfs/init.c
> +++ b/libxfs/init.c
> @@ -429,9 +429,9 @@ rtmount_init(
>  	if (sbp->sb_rblocks == 0)
>  		return 0;
>  	if (mp->m_rtdev_targp->dev == 0 && !(flags & LIBXFS_MOUNT_DEBUGGER)) {
> -		fprintf(stderr, _("%s: filesystem has a realtime subvolume\n"),
> -			progname);
> -		return -1;
> +		fprintf(stderr, _("This filesystem has a realtime subvolume.  "
> +			   "Specify rt device with the -r option.\n"));

_("%s: realtime subvolume must be specified.\n")?

--D

> +		exit(1);
>  	}
>  	mp->m_rsumlevels = sbp->sb_rextslog + 1;
>  	mp->m_rsumsize =
>
Eric Sandeen Sept. 30, 2020, 4 p.m. UTC | #3
On 9/30/20 10:59 AM, Darrick J. Wong wrote:
> On Wed, Sep 30, 2020 at 10:54:42AM -0500, Eric Sandeen wrote:
>> Today, if one tries to repair a filesystem with a realtime subvol but
>> forgets to specify the rtdev on the command line, the result sounds dire:
>>
>> Phase 1 - find and verify superblock...
>> xfs_repair: filesystem has a realtime subvolume
>> xfs_repair: realtime device init failed
>> xfs_repair: cannot repair this filesystem.  Sorry.
>>
>> We can be a bit more helpful, following the log device example:
>>
>> Phase 1 - find and verify superblock...
>> This filesystem has a realtime subvolume.  Specify rt device with the -r option.
>>
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>> diff --git a/libxfs/init.c b/libxfs/init.c
>> index cb8967bc..65cc3d4c 100644
>> --- a/libxfs/init.c
>> +++ b/libxfs/init.c
>> @@ -429,9 +429,9 @@ rtmount_init(
>>  	if (sbp->sb_rblocks == 0)
>>  		return 0;
>>  	if (mp->m_rtdev_targp->dev == 0 && !(flags & LIBXFS_MOUNT_DEBUGGER)) {
>> -		fprintf(stderr, _("%s: filesystem has a realtime subvolume\n"),
>> -			progname);
>> -		return -1;
>> +		fprintf(stderr, _("This filesystem has a realtime subvolume.  "
>> +			   "Specify rt device with the -r option.\n"));
> 
> _("%s: realtime subvolume must be specified.\n")?

except if we were called by xfs_copy, it can't handle it at all.

I'll need to move this to repair-specific code.

> --D
> 
>> +		exit(1);
>>  	}
>>  	mp->m_rsumlevels = sbp->sb_rextslog + 1;
>>  	mp->m_rsumsize =
>>
>
diff mbox series

Patch

diff --git a/libxfs/init.c b/libxfs/init.c
index cb8967bc..65cc3d4c 100644
--- a/libxfs/init.c
+++ b/libxfs/init.c
@@ -429,9 +429,9 @@  rtmount_init(
 	if (sbp->sb_rblocks == 0)
 		return 0;
 	if (mp->m_rtdev_targp->dev == 0 && !(flags & LIBXFS_MOUNT_DEBUGGER)) {
-		fprintf(stderr, _("%s: filesystem has a realtime subvolume\n"),
-			progname);
-		return -1;
+		fprintf(stderr, _("This filesystem has a realtime subvolume.  "
+			   "Specify rt device with the -r option.\n"));
+		exit(1);
 	}
 	mp->m_rsumlevels = sbp->sb_rextslog + 1;
 	mp->m_rsumsize =