diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-01-20 21:35:07 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:43 +0200 |
commit | 40405557b92dfe9cd581f914a5fa5f2c0e82d797 (patch) | |
tree | d18c4db25d02e757d1f780e4f47175ae1d6a891e /fs/bcachefs/btree_locking.c | |
parent | fixup bcachefs: Deadlock cycle detector (diff) | |
download | linux-40405557b92dfe9cd581f914a5fa5f2c0e82d797.tar.xz linux-40405557b92dfe9cd581f914a5fa5f2c0e82d797.zip |
fixup bcachefs: Deadlock cycle detector
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.c')
-rw-r--r-- | fs/bcachefs/btree_locking.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c index 76a532f98c72..5e9424fbc3be 100644 --- a/fs/bcachefs/btree_locking.c +++ b/fs/bcachefs/btree_locking.c @@ -226,6 +226,10 @@ static int lock_graph_descend(struct lock_graph *g, struct btree_trans *trans, while (g->nr) lock_graph_up(g); + + if (cycle) + return 0; + trace_and_count(trans->c, trans_restart_would_deadlock_recursion_limit, trans, _RET_IP_); return btree_trans_restart(orig_trans, BCH_ERR_transaction_restart_deadlock_recursion_limit); } @@ -248,6 +252,9 @@ int bch2_check_for_deadlock(struct btree_trans *trans, struct printbuf *cycle) int ret; if (trans->lock_must_abort) { + if (cycle) + return -1; + trace_and_count(trans->c, trans_restart_would_deadlock, trans, _RET_IP_); return btree_trans_restart(trans, BCH_ERR_transaction_restart_would_deadlock); } |