bcachefs: add missing bch2_trans_begin() call
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 23 Jul 2019 22:56:28 +0000 (18:56 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:24 +0000 (17:08 -0400)
for_each_btree_key() calls bch2_trans_get_iter() - we have to reset the
transaction state before getting the iterator again, in the retry path

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

index 8f16e252d2f1cbf082cf5ab23d167e061d573b6b..a539719661b859cd2d4ecea4beebf4ae32a05d8d 100644 (file)
@@ -1263,11 +1263,13 @@ static void bch2_read_retry(struct bch_fs *c, struct bch_read_bio *rbio,
        struct bkey_s_c k;
        int ret;
 
-       bch2_trans_init(&trans, c, 0, 0);
-
        flags &= ~BCH_READ_LAST_FRAGMENT;
        flags |= BCH_READ_MUST_CLONE;
+
+       bch2_trans_init(&trans, c, 0, 0);
 retry:
+       bch2_trans_begin(&trans);
+
        for_each_btree_key(&trans, iter, BTREE_ID_EXTENTS,
                           POS(inode, bvec_iter.bi_sector),
                           BTREE_ITER_SLOTS, k, ret) {