bcachefs: Fix unhandled transaction restart in evacuate_bucket()
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 8 Nov 2024 03:00:05 +0000 (22:00 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Dec 2024 06:36:16 +0000 (01:36 -0500)
Generally, releasing a transaction within a transaction restart means an
unhandled transaction restart: but this can happen legitimately within
the move code, e.g. when bch2_move_ratelimit() tells us to exit before
we've retried.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/move.c

index d6e68265e039628852b7538e05184f0ed4763ae1..a6b50327851902366e2164ef9eaeaa6c9bbd3f0a 100644 (file)
@@ -197,6 +197,13 @@ void bch2_moving_ctxt_exit(struct moving_context *ctxt)
        list_del(&ctxt->list);
        mutex_unlock(&c->moving_context_lock);
 
+       /*
+        * Generally, releasing a transaction within a transaction restart means
+        * an unhandled transaction restart: but this can happen legitimately
+        * within the move code, e.g. when bch2_move_ratelimit() tells us to
+        * exit before we've retried
+        */
+       bch2_trans_begin(ctxt->trans);
        bch2_trans_put(ctxt->trans);
        memset(ctxt, 0, sizeof(*ctxt));
 }