]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
libfrog: add directory tree structure scrubber to scrub library
authorDarrick J. Wong <djwong@kernel.org>
Wed, 3 Jul 2024 21:21:28 +0000 (14:21 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 31 Jul 2024 01:45:38 +0000 (18:45 -0700)
Make it so that scrub clients can detect corruptions within the
directory tree structure itself.  Update the documentation for the scrub
ioctl to mention this new functionality.

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

index baaa4b4d9402c7996b83e9c74dd54e266f7dbb9c..a2146e228f5b6dbdf7e9aa4d4a2d22dc79078f16 100644 (file)
@@ -149,6 +149,11 @@ const struct xfrog_scrub_descr xfrog_scrubbers[XFS_SCRUB_TYPE_NR] = {
                .descr  = "retained health records",
                .group  = XFROG_SCRUB_GROUP_NONE,
        },
+       [XFS_SCRUB_TYPE_DIRTREE] = {
+               .name   = "dirtree",
+               .descr  = "directory tree structure",
+               .group  = XFROG_SCRUB_GROUP_INODE,
+       },
 };
 #undef DEP
 
index 75ae52bb5847a394bc6dd6e50abb6d091fe1dbf8..44aa139b297a3b02565b61842d575d028a5937e5 100644 (file)
@@ -148,6 +148,20 @@ that points back to the subdirectory.
 The inode to examine can be specified in the same manner as
 .BR XFS_SCRUB_TYPE_INODE "."
 
+.TP
+.B XFS_SCRUB_TYPE_DIRTREE
+This scrubber looks for problems in the directory tree structure such as loops
+and directories accessible through more than one path.
+Problems are detected by walking parent pointers upwards towards the root.
+Loops are detected by comparing the parent directory at each step against the
+directories already examined.
+Directories with multiple paths are detected by counting the parent pointers
+attached to a directory.
+Non-directories do not have links pointing away from the directory tree root
+and can be skipped.
+The directory to examine can be specified in the same manner as
+.BR XFS_SCRUB_TYPE_INODE "."
+
 .TP
 .B XFS_SCRUB_TYPE_SYMLINK
 Examine the target of a symbolic link for obvious pathname problems.