summaryrefslogtreecommitdiff
path: root/fs/bcachefs/sysfs.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-02-18 13:22:35 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2018-02-19 18:00:35 -0500
commit02d7c0e4b51b52fccb937617b4b448ed278e17b6 (patch)
tree59678be4ac81a153391a1d759f150138a99ea3df /fs/bcachefs/sysfs.c
parent1fe226203d3d85f18cb3557ea7413fd9de12fe30 (diff)
bcachefs: fixes for check_set_has_compressed_data()
Diffstat (limited to 'fs/bcachefs/sysfs.c')
-rw-r--r--fs/bcachefs/sysfs.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index 2e958a8ef381..722aa2642b92 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -546,9 +546,8 @@ STORE(bch2_fs_opts_dir)
if (ret < 0)
return ret;
- mutex_lock(&c->sb_lock);
-
- if (id == Opt_compression) {
+ if (id == Opt_compression ||
+ id == Opt_background_compression) {
int ret = bch2_check_set_has_compressed_data(c, v);
if (ret) {
mutex_unlock(&c->sb_lock);
@@ -557,14 +556,14 @@ STORE(bch2_fs_opts_dir)
}
if (opt->set_sb != SET_NO_SB_OPT) {
+ mutex_lock(&c->sb_lock);
opt->set_sb(c->disk_sb, v);
bch2_write_super(c);
+ mutex_unlock(&c->sb_lock);
}
bch2_opt_set_by_id(&c->opts, id, v);
- mutex_unlock(&c->sb_lock);
-
return size;
}
SYSFS_OPS(bch2_fs_opts_dir);