Skip to content

Commit c37495f

Browse files
author
Kent Overstreet
committed
bcachefs: Add missing snapshots_seen_add_inorder()
This fixes an infinite loop when repairing "extent past end of inode", when the extent is an older snapshot than the inode that needs repair. Without the snaphsots_seen_add_inorder() we keep trying to delete the same extent, even though it's no longer visible in the inode's snapshot. Fixes: 63d6e93 ("bcachefs: bch2_fpunch_snapshot()") Signed-off-by: Kent Overstreet <[email protected]>
1 parent 1831840 commit c37495f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

fs/bcachefs/fsck.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,11 +1920,12 @@ static int check_extent(struct btree_trans *trans, struct btree_iter *iter,
19201920
"extent type past end of inode %llu:%u, i_size %llu\n%s",
19211921
i->inode.bi_inum, i->inode.bi_snapshot, i->inode.bi_size,
19221922
(bch2_bkey_val_to_text(&buf, c, k), buf.buf))) {
1923-
ret = bch2_fpunch_snapshot(trans,
1924-
SPOS(i->inode.bi_inum,
1925-
last_block,
1926-
i->inode.bi_snapshot),
1927-
POS(i->inode.bi_inum, U64_MAX));
1923+
ret = snapshots_seen_add_inorder(c, s, i->inode.bi_snapshot) ?:
1924+
bch2_fpunch_snapshot(trans,
1925+
SPOS(i->inode.bi_inum,
1926+
last_block,
1927+
i->inode.bi_snapshot),
1928+
POS(i->inode.bi_inum, U64_MAX));
19281929
if (ret)
19291930
goto err;
19301931

0 commit comments

Comments
 (0)