xfs: abort directory parent scrub scans if we encounter a zapped directory
authorDarrick J. Wong <djwong@kernel.org>
Fri, 15 Dec 2023 18:03:37 +0000 (10:03 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 15 Dec 2023 18:03:37 +0000 (10:03 -0800)
commit6c7289528d3c91855d78c56bb35fa360ed9a40bd
tree93edc842db6462f2a98ec8c0b72d4d55284373ea
parente744cef206055954517648070d2b3aaa3d2515ba
xfs: abort directory parent scrub scans if we encounter a zapped directory

In a previous patch, we added some code to perform sufficient repairs
to an ondisk inode record such that the inode cache would be willing to
load the inode.  If the broken inode was a shortform directory, it will
reset the directory to something plausible, which is to say an empty
subdirectory of the root.  The telltale signs that something is
seriously wrong is the broken link count.

Such directories look clean, but they shouldn't participate in a
filesystem scan to find or confirm a directory parent pointer.  Create a
predicate that identifies such directories and abort the scrub.

Found by fuzzing xfs/1554 with multithreaded xfs_scrub enabled and
u3.bmx[0].startblock = zeroes.

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