mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 23:00:21 +00:00
bcachefs: Fix locking in allocator thread
gc lock must be held while invalidating buckets - fixes "1f7a95698e bcachefs: Invalidate buckets when writing to alloc btree" Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
277c981c63
commit
94c1f4adec
@ -964,16 +964,21 @@ static int bch2_allocator_thread(void *arg)
|
||||
if (ret)
|
||||
goto stop;
|
||||
|
||||
ret = bch2_invalidate_buckets(c, ca);
|
||||
if (ret)
|
||||
goto stop;
|
||||
down_read(&c->gc_lock);
|
||||
|
||||
if (!fifo_empty(&ca->free_inc))
|
||||
ret = bch2_invalidate_buckets(c, ca);
|
||||
if (ret) {
|
||||
up_read(&c->gc_lock);
|
||||
goto stop;
|
||||
}
|
||||
|
||||
if (!fifo_empty(&ca->free_inc)) {
|
||||
up_read(&c->gc_lock);
|
||||
continue;
|
||||
}
|
||||
|
||||
pr_debug("free_inc now empty");
|
||||
|
||||
down_read(&c->gc_lock);
|
||||
do {
|
||||
if (test_bit(BCH_FS_GC_FAILURE, &c->flags)) {
|
||||
up_read(&c->gc_lock);
|
||||
|
Loading…
x
Reference in New Issue
Block a user