]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bcachefs: Fix looping around bch2_propagate_key_to_snapshot_leaves()
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 26 Sep 2023 21:11:23 +0000 (17:11 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:15 +0000 (17:10 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/snapshot.c

index cdf9eda2ee0284c764583a3ddb8a535d67459680..3ecc17b8d6fcaea206cb166d5ed58a5cad889f9c 100644 (file)
@@ -1636,9 +1636,15 @@ int bch2_propagate_key_to_snapshot_leaves(struct btree_trans *trans,
                if (!bch2_snapshot_is_ancestor(c, id, k.k->p.snapshot) ||
                    !bch2_snapshot_is_leaf(c, id))
                        continue;
+again:
+               ret =   btree_trans_too_many_iters(trans) ?:
+                       bch2_propagate_key_to_snapshot_leaf(trans, btree, k, id, new_min_pos) ?:
+                       bch2_trans_commit(trans, NULL, NULL, 0);
+               if (ret && bch2_err_matches(ret, BCH_ERR_transaction_restart)) {
+                       bch2_trans_begin(trans);
+                       goto again;
+               }
 
-               ret = commit_do(trans, NULL, NULL, 0,
-                               bch2_propagate_key_to_snapshot_leaf(trans, btree, k, id, new_min_pos));
                if (ret)
                        break;
        }