Commit c37495fe authored by Kent Overstreet's avatar Kent Overstreet
Browse files

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: 63d6e931 ("bcachefs: bch2_fpunch_snapshot()")
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 1831840c
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1920,7 +1920,8 @@ static int check_extent(struct btree_trans *trans, struct btree_iter *iter,
					"extent type past end of inode %llu:%u, i_size %llu\n%s",
					i->inode.bi_inum, i->inode.bi_snapshot, i->inode.bi_size,
					(bch2_bkey_val_to_text(&buf, c, k), buf.buf))) {
				ret = bch2_fpunch_snapshot(trans,
				ret =   snapshots_seen_add_inorder(c, s, i->inode.bi_snapshot) ?:
					bch2_fpunch_snapshot(trans,
							     SPOS(i->inode.bi_inum,
								  last_block,
								  i->inode.bi_snapshot),