bcachefs: Fix trans->locked assert
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 3 Jun 2024 22:00:48 +0000 (18:00 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 5 Jun 2024 14:44:08 +0000 (10:44 -0400)
in bch2_move_data_btree, we might start with the trans unlocked from a
previous loop iteration - we need a trans_begin() before iter_init().

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

index 2706d82423450cff4688e2470a17c80cde1e827e..6e477fadaa2a5b546e191f4da614e8d74722bd47 100644 (file)
@@ -547,6 +547,7 @@ static int bch2_move_data_btree(struct moving_context *ctxt,
                ctxt->stats->pos        = BBPOS(btree_id, start);
        }
 
+       bch2_trans_begin(trans);
        bch2_trans_iter_init(trans, &iter, btree_id, start,
                             BTREE_ITER_prefetch|
                             BTREE_ITER_all_snapshots);