bcachefs: Don't call into journal reclaim when we're not supposed to
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 8 Mar 2021 00:04:16 +0000 (19:04 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:53 +0000 (17:08 -0400)
This was causing a deadlock when btree_update_nodes_writtes() invokes
journal reclaim because of the btree cache being too dirty.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_update_leaf.c

index d99a78f8950dc7e160ef849d6d4b22f23baf9afb..70cf18bcbcddd443b55550439368b42228bb2e2c 100644 (file)
@@ -284,7 +284,8 @@ btree_key_can_insert_cached(struct btree_trans *trans,
        BUG_ON(iter->level);
 
        if (!test_bit(BKEY_CACHED_DIRTY, &ck->flags) &&
-           bch2_btree_key_cache_must_wait(trans->c))
+           bch2_btree_key_cache_must_wait(trans->c) &&
+           !(trans->flags & BTREE_INSERT_JOURNAL_RECLAIM))
                return BTREE_INSERT_NEED_JOURNAL_RECLAIM;
 
        if (u64s <= ck->u64s)