summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet2019-10-07 15:09:30 -0400
committerKent Overstreet2023-10-22 17:08:28 -0400
commita40d97a771387362dd272608ed2df0a1fd39343e (patch)
tree168e3117e596f5fb8698d8e3bcac6229455b4344
parent63fbf458cb7d7df6b58f982df7496f79ee9e6863 (diff)
bcachefs: Fix incorrect use of bch2_extent_atomic_end()
bch2_extent_atomic_end counts the number of iterators requried for marking overwrites - but journal replay never marks overwrites, so that part was incorrect. And counting iterators for the key being inserted should be unnecessary because we did that prior to the key being inserted before it was first journalled. This should fix an iterator overflow bug - the iterators for walking overwrites were totally unneeded. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/recovery.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 97c0d7d1fe77..095eef3828ce 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -268,10 +268,12 @@ retry:
BTREE_ITER_INTENT);
do {
- ret = bch2_extent_atomic_end(iter, k, &atomic_end);
+ ret = bch2_btree_iter_traverse(iter);
if (ret)
goto err;
+ atomic_end = bpos_min(k->k.p, iter->l[0].b->key.k.p);
+
split_iter = bch2_trans_copy_iter(&trans, iter);
ret = PTR_ERR_OR_ZERO(split_iter);
if (ret)