summaryrefslogtreecommitdiff
path: root/fs/bcachefs/disk_groups.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-08-12 22:00:08 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:43 +0300
commit01566db2fb1fca313d75b8b849ee95bb9ec5bcd7 (patch)
tree5de9aabd8964554a8213c86b87d39261eba701e8 /fs/bcachefs/disk_groups.c
parent142cbdff9b3d8e7fe8619d906f9eefd50b078f5f (diff)
downloadlinux-01566db2fb1fca313d75b8b849ee95bb9ec5bcd7.tar.xz
bcachefs: Fix disk groups not being updated when set via sysfs
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/disk_groups.c')
-rw-r--r--fs/bcachefs/disk_groups.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/bcachefs/disk_groups.c b/fs/bcachefs/disk_groups.c
index ee10308131e9..1c30065833c2 100644
--- a/fs/bcachefs/disk_groups.c
+++ b/fs/bcachefs/disk_groups.c
@@ -387,6 +387,7 @@ int bch2_dev_group_set(struct bch_fs *c, struct bch_dev *ca, const char *name)
{
struct bch_member *mi;
int v = -1;
+ int ret = 0;
mutex_lock(&c->sb_lock);
@@ -399,14 +400,18 @@ int bch2_dev_group_set(struct bch_fs *c, struct bch_dev *ca, const char *name)
return v;
}
+ ret = bch2_sb_disk_groups_to_cpu(c);
+ if (ret)
+ goto unlock;
write_sb:
mi = &bch2_sb_get_members(c->disk_sb.sb)->members[ca->dev_idx];
SET_BCH_MEMBER_GROUP(mi, v + 1);
bch2_write_super(c);
+unlock:
mutex_unlock(&c->sb_lock);
- return 0;
+ return ret;
}
int bch2_opt_target_parse(struct bch_fs *c, const char *buf, u64 *v)