bcachefs: Simplify break_cycle()
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 9 Oct 2022 08:55:02 +0000 (04:55 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:43 +0000 (17:09 -0400)
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>
fs/bcachefs/btree_locking.c

index 3973e8d7e6da23d09d13289f6cf3e78cc3f2dc79..4940b3069a76b5b122182d0eb57a0c6b49b30530 100644 (file)
@@ -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;