bcachefs: Fix an unhandled transaction restart error
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 19 Mar 2023 18:13:17 +0000 (14:13 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:58 +0000 (17:09 -0400)
This is a bit awkward: we're passing around a btree_trans, but we're not
in a context where transaction restarts are handled - we should try to
come up with a better way to denote situations like this.

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

index 4a9ffca7be629b95d9af247379a65b0ba5498d75..d94cefec988056f441f644deafb6143bc322fd89 100644 (file)
@@ -713,6 +713,11 @@ int __bch2_evacuate_bucket(struct btree_trans *trans,
 
        bch2_bkey_buf_init(&sk);
 
+       /*
+        * We're not run in a context that handles transaction restarts:
+        */
+       bch2_trans_begin(trans);
+
        bch2_trans_iter_init(trans, &iter, BTREE_ID_alloc,
                             bucket, BTREE_ITER_CACHED);
        ret = lockrestart_do(trans,