Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Daniel J Blueman and committed by
Kent Overstreet
b783fc4d 06974968

+2
+2
fs/bcachefs/disk_groups.c
··· 555 555 case TARGET_DEV: { 556 556 struct bch_dev *ca; 557 557 558 + out->atomic++; 558 559 rcu_read_lock(); 559 560 ca = t.dev < c->sb.nr_devices 560 561 ? rcu_dereference(c->devs[t.dev]) ··· 571 570 } 572 571 573 572 rcu_read_unlock(); 573 + out->atomic--; 574 574 break; 575 575 } 576 576 case TARGET_GROUP: