btrfs: small changes to "usebackuproot" mount
v2 cover btrfs: small changes to "usebackuproot" mount
[CHANGELOG]
v2:
- Also include "rescue=usebackroot" into "rescue=all" shortcut
"rescue=usebackuproot" mount option is not requiring a read-only mount, which is different from all the other options in the "rescue=" group. Address that in the first patch.
Standalone "usebackuproot" mount option is already marked deprecated since v5.9, I see no practical reason to keep supporting it in 2026. Just remove it in the second patch.
Qu Wenruo (3):
btrfs: add "rescue=usebackuproot" into forced read-only options
btrfs: add "rescue=usebackuproot" into "rescue=all" shortcut
btrfs: remove "usebackuproot" mount option
fs/btrfs/super.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
Signature · 1 line
2.54.0
PATCH v2 1/3 btrfs: add "rescue=usebackuproot" into forced read-only options
According to btrfs(5) man page, all rescue options should require an read-only mount.
But that read-only check is only introduced for newer rescue options, not for the pre-existing "usebackuproot" one.
Unify the behavior to match the document.
--- fs/btrfs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/super.c +2 -1
@@ -692,7 +692,8 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,bool ret = true; if (!(flags & SB_RDONLY) && - (check_ro_option(info, *mount_opt, BTRFS_MOUNT_NOLOGREPLAY, "nologreplay") || + (check_ro_option(info, *mount_opt, BTRFS_MOUNT_USEBACKUPROOT, "usebackuproot") || + check_ro_option(info, *mount_opt, BTRFS_MOUNT_NOLOGREPLAY, "nologreplay") || check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREBADROOTS, "ignorebadroots") || check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREDATACSUMS, "ignoredatacsums") || check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREMETACSUMS, "ignoremetacsums") ||
Signature · 1 line
2.54.0
Re: [PATCH v2 1/3] btrfs: add "rescue=usebackuproot" into forced read-only options
Quoted 18 lines · Qu Wenruo
According to btrfs(5) man page, all rescue options should require an read-only mount.
But that read-only check is only introduced for newer rescue options, not for the pre-existing "usebackuproot" one.
Unify the behavior to match the document.
Signed-off-by Qu Wenruo <[email protected]>--- fs/btrfs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/btrfs/super.c +0
-0
fs/btrfs/super.c bool btrfs_check_options(const struct btrfs_fs_info *info, · line 699
Quoted 9 lines
fs/btrfs/super.c +2
-1@@ -692,7 +692,8 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,bool ret = true; if (!(flags & SB_RDONLY) && - (check_ro_option(info, *mount_opt, BTRFS_MOUNT_NOLOGREPLAY, "nologreplay") || + (check_ro_option(info, *mount_opt, BTRFS_MOUNT_USEBACKUPROOT, "usebackuproot") || + check_ro_option(info, *mount_opt, BTRFS_MOUNT_NOLOGREPLAY, "nologreplay") || check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREBADROOTS, "ignorebadroots") || check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREDATACSUMS, "ignoredatacsums") || check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREMETACSUMS, "ignoremetacsums") ||
Hi Qu,
One more thing I noticed: should BTRFS_MOUNT_USEBACKUPROOT also be added to BTRFS_MOUNT_FULL_RO_MASK?
Thanks,
Dongjiang
Re: [PATCH v2 1/3] btrfs: add "rescue=usebackuproot" into forced read-only options
Quoted 31 lines · Dongjiang Zhu
Quoted 18 lines · Qu Wenruo
According to btrfs(5) man page, all rescue options should require an read-only mount.
But that read-only check is only introduced for newer rescue options, not for the pre-existing "usebackuproot" one.
Unify the behavior to match the document.
Signed-off-by Qu Wenruo <[email protected]>--- fs/btrfs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/btrfs/super.c +0
-0fs/btrfs/super.c bool btrfs_check_options(const struct btrfs_fs_info *info, · line 699
Quoted 9 lines
fs/btrfs/super.c +2
-1@@ -692,7 +692,8 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,bool ret = true; if (!(flags & SB_RDONLY) && - (check_ro_option(info, *mount_opt, BTRFS_MOUNT_NOLOGREPLAY, "nologreplay") || + (check_ro_option(info, *mount_opt, BTRFS_MOUNT_USEBACKUPROOT, "usebackuproot") || + check_ro_option(info, *mount_opt, BTRFS_MOUNT_NOLOGREPLAY, "nologreplay") || check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREBADROOTS, "ignorebadroots") || check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREDATACSUMS, "ignoredatacsums") || check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREMETACSUMS, "ignoremetacsums") ||Hi Qu,
Quoted 2 lines
One more thing I noticed: should
BTRFS_MOUNT_USEBACKUPROOTalso be added toBTRFS_MOUNT_FULL_RO_MASK?
Thanks for pointing this out, you're completely right.
Quoted 4 lines
Thanks,
Dongjiang
PATCH v2 2/3 btrfs: add "rescue=usebackuproot" into "rescue=all" shortcut
In reply to Qu WenruoThe mount option "rescue=all" should be a shortcut to include all "rescue=" mount options. but unfortunately "rescue=usebackuproot" is not include.
Include that option so "rescue=all" have a better chance to mount a corrupted fs.
--- fs/btrfs/super.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/super.c +1 -0
@@ -620,6 +620,7 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)btrfs_set_opt (ctx->mount_opt,IGNORESUPERFLAGS );btrfs_set_opt (ctx->mount_opt,IGNOREBADROOTS );btrfs_set_opt (ctx->mount_opt,NOLOGREPLAY ); +btrfs_set_opt (ctx->mount_opt,USEBACKUPROOT );break ;default : btrfs_info(NULL, "unrecognized rescue option '%s'",
Signature · 1 line
2.54.0
PATCH v2 3/3 btrfs: remove "usebackuproot" mount option
In reply to Qu WenruoThis mount option is marked deprecated since the introduction of "rescue=" mount option group, in v5.9.
That's already a long long time ago, and it should be safe to completely remove the old "usebackuproot" mount option now.
--- fs/btrfs/super.c | 11 ----------- 1 file changed, 11 deletions(-)
fs/btrfs/super.c +0 -11
@@ -128,7 +128,6 @@ enum {/* Rescue options */ Opt_rescue, - Opt_usebackuproot,/* Debugging options */ Opt_enospc_debug,
@@ -248,8 +247,6 @@ static const struct fs_parameter_spec btrfs_fs_parameters[] = {/* Rescue options. */ fsparam_enum ("rescue" , Opt_rescue, btrfs_parameter_rescue), -/* Deprecated, with alias rescue=usebackuproot */ -__fsparam (NULL ,"usebackuproot" , Opt_usebackuproot, fs_param_deprecated,NULL ),/* For compatibility only, alias for "rescue=nologreplay". */ fsparam_flag("norecovery", Opt_norecovery),
@@ -560,14 +557,6 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)else btrfs_set_opt (ctx->mount_opt,AUTO_DEFRAG );break ; -case Opt_usebackuproot: -btrfs_warn (NULL , -"'usebackuproot' is deprecated, use 'rescue=usebackuproot' instead" ); -btrfs_set_opt (ctx->mount_opt,USEBACKUPROOT ); - -/* If we're loading the backup roots we can't trust the space cache. */ -btrfs_set_opt (ctx->mount_opt,CLEAR_CACHE ); -break ;case Opt_skip_balance:btrfs_set_opt (ctx->mount_opt,SKIP_BALANCE );break ;
Signature · 1 line
2.54.0