Skip to content

Commit

Permalink
bcachefs: Fix potential sleeping during mount
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel J Blueman authored and Kent Overstreet committed Nov 15, 2023
1 parent 0697496 commit b783fc4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/bcachefs/disk_groups.c
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit b783fc4

Please sign in to comment.