summaryrefslogtreecommitdiff
path: root/fs/btrfs/super.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2023-11-22 12:17:53 -0500
committerDavid Sterba <dsterba@suse.com>2023-12-15 20:27:04 +0100
commit83e3a40a69f8dd57048089af31a1430c1808d924 (patch)
tree2b3c903bce932d4dc39ea652f1c5e5ae9a69ed55 /fs/btrfs/super.c
parent6941823cc87812dba4d02c67f46768cba372970b (diff)
btrfs: move one shot mount option clearing to super.c
There's no reason this has to happen in open_ctree, and in fact in the old mount API we had to call this from remount. Move this to super.c, unexport it, and call it from both mount and reconfigure. 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.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index f9488161bf83..95d6392a1acf 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -631,6 +631,18 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
return 0;
}
+/*
+ * Some options only have meaning at mount time and shouldn't persist across
+ * remounts, or be displayed. Clear these at the end of mount and remount code
+ * paths.
+ */
+static void btrfs_clear_oneshot_options(struct btrfs_fs_info *fs_info)
+{
+ btrfs_clear_opt(fs_info->mount_opt, USEBACKUPROOT);
+ btrfs_clear_opt(fs_info->mount_opt, CLEAR_CACHE);
+ btrfs_clear_opt(fs_info->mount_opt, NOSPACECACHE);
+}
+
static bool check_ro_option(struct btrfs_fs_info *fs_info,
unsigned long mount_opt, unsigned long opt,
const char *opt_name)
@@ -1865,6 +1877,8 @@ static int btrfs_get_tree_super(struct fs_context *fc)
return ret;
}
+ btrfs_clear_oneshot_options(fs_info);
+
fc->root = dget(sb->s_root);
return 0;