Commit a0e491c0 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Don't allocate memory while holding journal reservation

This fixes a lockdep splat - allocating memory can call
bch2_clear_page_bits() which takes mark_lock.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 2c31e657
......@@ -713,13 +713,6 @@ static void btree_update_nodes_written(struct closure *cl)
bch2_btree_add_journal_pin(c, b, res.seq);
six_unlock_write(&b->c.lock);
/*
* b->write_blocked prevented it from being written, so
* write it now if it needs to be written:
*/
btree_node_write_if_need(c, b, SIX_LOCK_intent);
six_unlock_intent(&b->c.lock);
break;
case BTREE_INTERIOR_UPDATING_AS:
......@@ -746,6 +739,16 @@ static void btree_update_nodes_written(struct closure *cl)
bch2_journal_res_put(&c->journal, &res);
bch2_journal_preres_put(&c->journal, &as->journal_preres);
/* Do btree write after dropping journal res: */
if (b) {
/*
* b->write_blocked prevented it from being written, so
* write it now if it needs to be written:
*/
btree_node_write_if_need(c, b, SIX_LOCK_intent);
six_unlock_intent(&b->c.lock);
}
btree_update_nodes_reachable(as, res.seq);
free_update:
__bch2_btree_update_free(as);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment