summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Blueman <daniel@quora.org>2023-11-12 00:38:41 +0000
committerKent Overstreet <kent.overstreet@linux.dev>2023-11-11 22:20:54 -0500
commitc763b5f72018857148ea1dfa71c01deefb25b25e (patch)
tree27d3fe852eac0e4aff7d7ff0565cf08322f48642
parent1f1b1b720132c7d586adfa859e8ad07f36eb9761 (diff)
bcachefs: Fix potential sleeping during mount
During mount, bcachefs mount option processing may sleep while allocating a string buffer. Fix this by reference counting in order to take the atomic path. Signed-off-by: Daniel J Blueman <daniel@quora.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/disk_groups.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/disk_groups.c b/fs/bcachefs/disk_groups.c
index 1f334124055b..4d0cb0ccff32 100644
--- a/fs/bcachefs/disk_groups.c
+++ b/fs/bcachefs/disk_groups.c
@@ -555,6 +555,7 @@ void bch2_target_to_text(struct printbuf *out, struct bch_fs *c, unsigned v)
case TARGET_DEV: {
struct bch_dev *ca;
+ out->atomic++;
rcu_read_lock();
ca = t.dev < c->sb.nr_devices
? rcu_dereference(c->devs[t.dev])
@@ -570,6 +571,7 @@ void bch2_target_to_text(struct printbuf *out, struct bch_fs *c, unsigned v)
}
rcu_read_unlock();
+ out->atomic--;
break;
}
case TARGET_GROUP: