summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-03-26 18:41:07 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2025-03-28 18:13:25 +0300
commit2dd202dbaf0acfa4af7fcdf258f35866e31f7425 (patch)
tree6cc3198b97a40379718ef6f1fc687d81f795d397 /fs/bcachefs/alloc_background.c
parentc6c6a391097a6367cdbc663957010f03d9dbb361 (diff)
downloadlinux-2dd202dbaf0acfa4af7fcdf258f35866e31f7425.tar.xz
bcachefs: Recovery no longer holds state_lock
state_lock guards against devices coming or leaving, changing state, or the filesystem changing between ro <-> rw. But it's not necessary for running recovery passes, and holding it blocks asynchronous events that would cause us to go RO or kick out devices. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r--fs/bcachefs/alloc_background.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 5fb396be9127..b6dbeaa9c7ab 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -589,6 +589,8 @@ iter_err:
int bch2_alloc_read(struct bch_fs *c)
{
+ down_read(&c->state_lock);
+
struct btree_trans *trans = bch2_trans_get(c);
struct bch_dev *ca = NULL;
int ret;
@@ -652,6 +654,7 @@ int bch2_alloc_read(struct bch_fs *c)
bch2_dev_put(ca);
bch2_trans_put(trans);
+ up_read(&c->state_lock);
bch_err_fn(c, ret);
return ret;
}