Commit b783fc4d authored by Daniel J Blueman's avatar Daniel J Blueman Committed by Kent Overstreet

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: default avatarDaniel J Blueman <daniel@quora.org>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 06974968
...@@ -555,6 +555,7 @@ void bch2_target_to_text(struct printbuf *out, struct bch_fs *c, unsigned v) ...@@ -555,6 +555,7 @@ void bch2_target_to_text(struct printbuf *out, struct bch_fs *c, unsigned v)
case TARGET_DEV: { case TARGET_DEV: {
struct bch_dev *ca; struct bch_dev *ca;
out->atomic++;
rcu_read_lock(); rcu_read_lock();
ca = t.dev < c->sb.nr_devices ca = t.dev < c->sb.nr_devices
? rcu_dereference(c->devs[t.dev]) ? rcu_dereference(c->devs[t.dev])
...@@ -570,6 +571,7 @@ void bch2_target_to_text(struct printbuf *out, struct bch_fs *c, unsigned v) ...@@ -570,6 +571,7 @@ void bch2_target_to_text(struct printbuf *out, struct bch_fs *c, unsigned v)
} }
rcu_read_unlock(); rcu_read_unlock();
out->atomic--;
break; break;
} }
case TARGET_GROUP: case TARGET_GROUP:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment