Skip to content

Commit 218e5e0

Browse files
author
Kent Overstreet
committed
bcachefs: Fix locking assert
We now track whether a transaction is locked, and verify that we don't have nodes locked when the transaction isn't locked; reorder relocks to not pop the new assert. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 9e1a66e commit 218e5e0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

fs/bcachefs/btree_key_cache.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,16 +424,16 @@ static int btree_key_cache_fill(struct btree_trans *trans,
424424
goto err;
425425
}
426426

427-
if (!bch2_btree_node_relock(trans, ck_path, 0)) {
427+
ret = bch2_trans_relock(trans);
428+
if (ret) {
428429
kfree(new_k);
429-
trace_and_count(trans->c, trans_restart_relock_key_cache_fill, trans, _THIS_IP_, ck_path);
430-
ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_fill);
431430
goto err;
432431
}
433432

434-
ret = bch2_trans_relock(trans);
435-
if (ret) {
433+
if (!bch2_btree_node_relock(trans, ck_path, 0)) {
436434
kfree(new_k);
435+
trace_and_count(trans->c, trans_restart_relock_key_cache_fill, trans, _THIS_IP_, ck_path);
436+
ret = btree_trans_restart(trans, BCH_ERR_transaction_restart_key_cache_fill);
437437
goto err;
438438
}
439439
}

0 commit comments

Comments
 (0)