summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2023-11-22 20:17:54 +0300
committerDavid Sterba <dsterba@suse.com>2023-12-15 22:27:05 +0300
commit9fb3b1a7fed796510a5c34f5d492840dfd0eb96c (patch)
tree0038bec1c0b78c2131f7c84aba100d7345115d6c /fs/btrfs/super.c
parent83e3a40a69f8dd57048089af31a1430c1808d924 (diff)
downloadlinux-9fb3b1a7fed796510a5c34f5d492840dfd0eb96c.tar.xz
btrfs: set clear_cache if we use usebackuproot
We're currently setting this when we try to load the roots and we see that usebackuproot is set. Instead set this at mount option parsing time. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Acked-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r--fs/btrfs/super.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 95d6392a1acf..04352d3861a2 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -452,6 +452,12 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
btrfs_warn(NULL,
"'recovery' 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_nologreplay:
@@ -550,6 +556,9 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
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);