]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bcachefs: Fix unhandled transaction restart in bch2_gc_btree_gens()
authorKent Overstreet <kent.overstreet@gmail.com>
Sun, 22 Aug 2021 16:56:56 +0000 (12:56 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:10 +0000 (17:09 -0400)
This fixes https://github.com/koverstreet/bcachefs/issues/305

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_gc.c

index 2a84685f4e6088b4eb778b6cd2349906c50f4bce..4a3f39a619a1e3cd9ac0099e410e19ed70b0d06b 100644 (file)
@@ -1736,8 +1736,14 @@ static int bch2_gc_btree_gens(struct bch_fs *c, enum btree_id btree_id)
                                   BTREE_ITER_ALL_SNAPSHOTS);
 
        while ((bch2_trans_begin(&trans),
-               k = bch2_btree_iter_peek(iter)).k &&
-              !(ret = bkey_err(k))) {
+               k = bch2_btree_iter_peek(iter)).k) {
+               ret = bkey_err(k);
+
+               if (ret == -EINTR)
+                       continue;
+               if (ret)
+                       break;
+
                c->gc_gens_pos = iter->pos;
 
                if (gc_btree_gens_key(c, k) && !commit_err) {