summaryrefslogtreecommitdiff
path: root/fs/bcachefs/snapshot.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-09-26 17:11:23 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:10:15 -0400
commitd281701b00fc857755cd0fc08a415a694d5f49c0 (patch)
treeb6b13a7247da223a2552431c16d7eb6a3491d356 /fs/bcachefs/snapshot.c
parentd2a990d1b132c8124a3856706f6b3663b9059bb5 (diff)
downloadlwn-d281701b00fc857755cd0fc08a415a694d5f49c0.tar.gz
lwn-d281701b00fc857755cd0fc08a415a694d5f49c0.zip
bcachefs: Fix looping around bch2_propagate_key_to_snapshot_leaves()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/snapshot.c')
-rw-r--r--fs/bcachefs/snapshot.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index cdf9eda2ee02..3ecc17b8d6fc 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -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;
}