bcachefs: Fix a locking bug

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2019-02-11 19:04:40 -05:00 committed by Kent Overstreet
parent 6639339253
commit 053dbb377d
2 changed files with 4 additions and 0 deletions

View File

@ -883,6 +883,7 @@ static int bch2_invalidate_buckets(struct bch_fs *c, struct bch_dev *ca)
ret = __bch2_alloc_write_key(c, ca, b, &iter,
must_flush ? &journal_seq : NULL,
BTREE_INSERT_GC_LOCK_HELD|
!fifo_empty(&ca->free_inc) ? BTREE_INSERT_NOWAIT : 0);
}

View File

@ -624,6 +624,9 @@ int __bch2_btree_insert_at(struct btree_insert *trans)
/* for the sake of sanity: */
BUG_ON(trans->nr > 1 && !(trans->flags & BTREE_INSERT_ATOMIC));
if (trans->flags & BTREE_INSERT_GC_LOCK_HELD)
lockdep_assert_held(&c->gc_lock);
bubble_sort(trans->entries, trans->nr, btree_trans_cmp);
trans_for_each_entry(trans, i)