diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-04 12:51:49 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-05-06 10:58:17 -0400 |
commit | 3a2d0259274202432e5119463dd4cf5f9fabed98 (patch) | |
tree | 52bf7139b99cecf0ce982114fd0f733f37c14a01 /fs/bcachefs | |
parent | 1267df40acb2da62b1641abae26132411d093fb3 (diff) |
bcachefs: Fix bch2_dev_lookup() refcounting
bch2_dev_lookup() is supposed to take a ref on the device it returns, but
for_each_member_device() takes refs as it iterates,
for_each_member_device_rcu() does not.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r-- | fs/bcachefs/super.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 88e214c609bb..c2c80e6890ae 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -2004,13 +2004,9 @@ err: /* return with ref on ca->ref: */ struct bch_dev *bch2_dev_lookup(struct bch_fs *c, const char *name) { - rcu_read_lock(); - for_each_member_device_rcu(c, ca, NULL) - if (!strcmp(name, ca->name)) { - rcu_read_unlock(); + for_each_member_device(c, ca) + if (!strcmp(name, ca->name)) return ca; - } - rcu_read_unlock(); return ERR_PTR(-BCH_ERR_ENOENT_dev_not_found); } |