mirror of
https://github.com/torvalds/linux
synced 2024-07-21 18:51:47 +00:00
bcachefs: Fix a locking bug in the do_discard_fast() path
We can't discard a bucket while it's still open; this needs the bucket_is_open_safe() version, which takes the open_buckets lock. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
d47df4f616
commit
3727ca5604
|
@ -882,7 +882,7 @@ int bch2_trigger_alloc(struct btree_trans *trans,
|
||||||
closure_wake_up(&c->freelist_wait);
|
closure_wake_up(&c->freelist_wait);
|
||||||
|
|
||||||
if (statechange(a->data_type == BCH_DATA_need_discard) &&
|
if (statechange(a->data_type == BCH_DATA_need_discard) &&
|
||||||
!bch2_bucket_is_open(c, new.k->p.inode, new.k->p.offset) &&
|
!bch2_bucket_is_open_safe(c, new.k->p.inode, new.k->p.offset) &&
|
||||||
bucket_flushed(new_a))
|
bucket_flushed(new_a))
|
||||||
bch2_discard_one_bucket_fast(c, new.k->p);
|
bch2_discard_one_bucket_fast(c, new.k->p);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue