Commit 8707ab0d authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix another error path locking bug

btree_update_nodes_written() was leaking a btree node lock on failure to
get a journal reservation.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 75923ba7
......@@ -725,7 +725,7 @@ 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);
free_update:
/* Do btree write after dropping journal res: */
if (b) {
/*
......@@ -736,8 +736,9 @@ static void btree_update_nodes_written(struct closure *cl)
six_unlock_intent(&b->c.lock);
}
btree_update_nodes_reachable(as, res.seq);
free_update:
if (!ret)
btree_update_nodes_reachable(as, res.seq);
__bch2_btree_update_free(as);
/*
* for flush_held_btree_writes() waiting on updates to flush or
......
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