Skip to content

Commit b783fc4

Browse files
dbluemanKent Overstreet
authored andcommitted
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>
1 parent 0697496 commit b783fc4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/bcachefs/disk_groups.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ void bch2_target_to_text(struct printbuf *out, struct bch_fs *c, unsigned v)
555555
case TARGET_DEV: {
556556
struct bch_dev *ca;
557557

558+
out->atomic++;
558559
rcu_read_lock();
559560
ca = t.dev < c->sb.nr_devices
560561
? rcu_dereference(c->devs[t.dev])
@@ -570,6 +571,7 @@ void bch2_target_to_text(struct printbuf *out, struct bch_fs *c, unsigned v)
570571
}
571572

572573
rcu_read_unlock();
574+
out->atomic--;
573575
break;
574576
}
575577
case TARGET_GROUP:

0 commit comments

Comments
 (0)