diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-09 04:55:02 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:43 -0400 |
commit | fe2de9a8dc8312a0992d91c1d63d93bf28574bcf (patch) | |
tree | 86e6ddd8ba3779848a2c28b9b5302ada9accc295 /fs/bcachefs/btree_locking.c | |
parent | 1148a97f1fb9b80ef5355021f0c2dfc7b8f003a2 (diff) |
bcachefs: Simplify break_cycle()
We'd like to prioritize aborting transactions that have done less work -
however, it appears breaking cycles by telling other threads to abort
may still be buggy, so disable that for now.
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 | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/bcachefs/btree_locking.c b/fs/bcachefs/btree_locking.c index 3973e8d7e6da..4940b3069a76 100644 --- a/fs/bcachefs/btree_locking.c +++ b/fs/bcachefs/btree_locking.c @@ -96,25 +96,26 @@ static noinline void print_chain(struct printbuf *out, struct lock_graph *g) static int abort_lock(struct lock_graph *g, struct trans_waiting_for_lock *i) { - int ret; - if (i == g->g) { trace_and_count(i->trans->c, trans_restart_would_deadlock, i->trans, _RET_IP_); - ret = btree_trans_restart(i->trans, BCH_ERR_transaction_restart_would_deadlock); + return btree_trans_restart(i->trans, BCH_ERR_transaction_restart_would_deadlock); } else { i->trans->lock_must_abort = true; - ret = 0; - } - - for (i = g->g + 1; i < g->g + g->nr; i++) wake_up_process(i->trans->locking_wait.task); - return ret; + return 0; + } } static noinline int break_cycle(struct lock_graph *g) { struct trans_waiting_for_lock *i; + /* + * We'd like to prioritize aborting transactions that have done less + * work - but it appears breaking cycles by telling other transactions + * to abort may still be buggy: + */ +#if 0 for (i = g->g; i < g->g + g->nr; i++) { if (i->trans->lock_may_not_fail || i->trans->locking_wait.lock_want == SIX_LOCK_write) @@ -130,7 +131,7 @@ static noinline int break_cycle(struct lock_graph *g) return abort_lock(g, i); } - +#endif for (i = g->g; i < g->g + g->nr; i++) { if (i->trans->lock_may_not_fail) continue; |