xfs: repair link count of nondirectories after rebuilding parent pointers
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 16:48:18 +0000 (09:48 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 23 Apr 2024 23:55:16 +0000 (16:55 -0700)
commit3f50ddbf4b470f8566f99a83597da50180d937c0
treeefdd47c3587f44c2ec304ceff2d730945597ed18
parent7be3d20bbeda6602d6c5f67ec2b8f189a07ea0e3
xfs: repair link count of nondirectories after rebuilding parent pointers

Since the parent pointer scrubber does not exhaustively search the
filesystem for missing parent pointers, it doesn't have a good way to
determine that there are pointers missing from an otherwise uncorrupt
xattr structure.  Instead, for nondirectories it employs a heuristic of
comparing the file link count to the number of parent pointers found.

However, we don't want this heuristic flagging a false corruption after
a repair has actually scanned the entire filesystem to rebuild the
parent pointers.  Therefore, reset the file link count in this one case
because we actually know the correct link count.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/scrub/parent_repair.c