]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs_scrub: detect and repair directory tree corruptions
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:23:28 +0000 (16:23 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:13 +0000 (17:01 -0700)
commit0300ffbae7401a132dc8944a9281db3df81a667b
tree6d8fb14183091d0a564a522e50bd5c212f807bb8
parent1fe7d5ef7a0b47e375f7a51d502f574f9ad8811a
xfs_scrub: detect and repair directory tree corruptions

Now that we have online fsck for directory tree structure problems, we
need to find a place to call it.  The scanner requires that parent
pointers are enabled, that directory link counts are correct, and that
every directory entry has a corresponding parent pointer.  Therefore, we
can only run it after phase 4 fixes every file, and phase 5 resets the
link counts.

In other words, we call it as part of the phase 5 file scan that we do
to warn about weird looking file names.  This has the added benefit that
opening the directory by handle is less likely to fail if there are
loops in the directory structure.  For now, only plumb in enough to try
to fix directory tree problems right away; the next patch will make
phase 5 retry the dirloop scanner until the problems are fixed or we
stop making forward progress.

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