]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bcachefs: Fix opt hooks in sysfs for non sb option
authorKent Overstreet <kent.overstreet@linux.dev>
Wed, 14 May 2025 21:58:00 +0000 (17:58 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 22 May 2025 00:14:59 +0000 (20:14 -0400)
We weren't checking if the option changed for non-superblock options -
this led to rebalance not waking up when enabling the
"rebalance_enabled" option.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/sysfs.c

index 4c7d609d79fd3b1c94daf73461ccaa1ff3c69f47..de7cda282a8c7d73fa9406f36dc4a540ae329fc6 100644 (file)
@@ -642,7 +642,18 @@ static ssize_t sysfs_opt_store(struct bch_fs *c,
        if (ret < 0)
                goto err;
 
-       bool changed = bch2_opt_set_sb(c, ca, opt, v);
+       bool is_sb = opt->get_sb || opt->get_member;
+       bool changed = false;
+
+       if (is_sb) {
+               changed = bch2_opt_set_sb(c, ca, opt, v);
+       } else if (!ca) {
+               changed = bch2_opt_get_by_id(&c->opts, id) != v;
+       } else {
+               /* device options that aren't superblock options aren't
+                * supported */
+               BUG();
+       }
 
        if (!ca)
                bch2_opt_set_by_id(&c->opts, id, v);