]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: check metadata directory file path connectivity
authorDarrick J. Wong <djwong@kernel.org>
Wed, 3 Jul 2024 21:21:49 +0000 (14:21 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:13:16 +0000 (17:13 -0700)
Create a new scrubber type that checks that well known metadata
directory paths are connected to the metadata inode that the incore
structures think is in use.  IOWs, check that "/quota/user" in the
metadata directory tree actually points to
mp->m_quotainfo->qi_uquotaip->i_ino.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
libxfs/xfs_fs.h
libxfs/xfs_health.h
man/man2/ioctl_xfs_scrub_metadata.2

index 6f5aebaf47ac814e2f43de624b641e9df22c6e67..ad89c3eee44b000145ffa14e943ff616e031466c 100644 (file)
@@ -198,6 +198,7 @@ struct xfs_fsop_geom {
 #define XFS_FSOP_GEOM_SICK_QUOTACHECK  (1 << 6)  /* quota counts */
 #define XFS_FSOP_GEOM_SICK_NLINKS      (1 << 7)  /* inode link counts */
 #define XFS_FSOP_GEOM_SICK_METADIR     (1 << 8)  /* metadata directory */
+#define XFS_FSOP_GEOM_SICK_METAPATH    (1 << 9)  /* metadir tree path */
 
 /* Output for XFS_FS_COUNTS */
 typedef struct xfs_fsop_counts {
@@ -732,9 +733,10 @@ struct xfs_scrub_metadata {
 #define XFS_SCRUB_TYPE_NLINKS  26      /* inode link counts */
 #define XFS_SCRUB_TYPE_HEALTHY 27      /* everything checked out ok */
 #define XFS_SCRUB_TYPE_DIRTREE 28      /* directory tree structure */
+#define XFS_SCRUB_TYPE_METAPATH        29      /* metadata directory tree paths */
 
 /* Number of scrub subcommands. */
-#define XFS_SCRUB_TYPE_NR      29
+#define XFS_SCRUB_TYPE_NR      30
 
 /*
  * This special type code only applies to the vectored scrub implementation.
@@ -812,6 +814,15 @@ struct xfs_scrub_vec_head {
 
 #define XFS_SCRUB_VEC_FLAGS_ALL                (0)
 
+/*
+ * i: sm_ino values for XFS_SCRUB_TYPE_METAPATH to select a metadata file for
+ * path checking.
+ */
+#define XFS_SCRUB_METAPATH_PROBE       (0)  /* do we have a metapath scrubber? */
+
+/* Number of metapath sm_ino values */
+#define XFS_SCRUB_METAPATH_NR          1
+
 /*
  * ioctl limits
  */
index 0ded0cd93ce633775e227b2d5a12fdbfc306038b..8abd345e23885e4f8211df639f5ec6b6312481b8 100644 (file)
@@ -61,6 +61,7 @@ struct xfs_da_args;
 #define XFS_SICK_FS_QUOTACHECK (1 << 4)  /* quota counts */
 #define XFS_SICK_FS_NLINKS     (1 << 5)  /* inode link counts */
 #define XFS_SICK_FS_METADIR    (1 << 6)  /* metadata directory tree */
+#define XFS_SICK_FS_METAPATH   (1 << 7)  /* metadata directory tree path */
 
 /* Observable health issues for realtime volume metadata. */
 #define XFS_SICK_RT_BITMAP     (1 << 0)  /* realtime bitmap */
@@ -105,7 +106,8 @@ struct xfs_da_args;
                                 XFS_SICK_FS_PQUOTA | \
                                 XFS_SICK_FS_QUOTACHECK | \
                                 XFS_SICK_FS_NLINKS | \
-                                XFS_SICK_FS_METADIR)
+                                XFS_SICK_FS_METADIR | \
+                                XFS_SICK_FS_METAPATH)
 
 #define XFS_SICK_RT_PRIMARY    (XFS_SICK_RT_BITMAP | \
                                 XFS_SICK_RT_SUMMARY)
index 44aa139b297a3b02565b61842d575d028a5937e5..b1db740560d78b6b5a734a3c4edaebc092ca4774 100644 (file)
@@ -200,6 +200,44 @@ Scan all inodes in the filesystem to verify each file's link count.
 Mark everything healthy after a clean scrub run.
 This clears out all the indirect health problem markers that might remain
 in the system.
+
+.TP
+.B XFS_SCRUB_TYPE_METAPATH
+Check that a metadata directory path actually points to the active metadata
+inode.
+Metadata inodes are usually cached for the duration of the mount, so this
+scrubber ensures that the same inode will still be reachable after an unmount
+and mount cycle.
+Discrepancies can happen if the directory or parent pointer scrubbers rebuild
+a metadata directory but lose a link in the process.
+The
+.B sm_ino
+field should be passed one of the following special values to communicate which
+path to check:
+
+.RS 7
+.TP
+.B XFS_SCRUB_METAPATH_RTBITMAP
+Realtime bitmap file.
+.TP
+.B XFS_SCRUB_METAPATH_RTSUMMARY
+Realtime summary file.
+.TP
+.B XFS_SCRUB_METAPATH_USRQUOTA
+User quota file.
+.TP
+.B XFS_SCRUB_METAPATH_GRPQUOTA
+Group quota file.
+.TP
+.B XFS_SCRUB_METAPATH_PRJQUOTA
+Project quota file.
+.RE
+
+The values of
+.I sm_agno
+and
+.I sm_gen
+must be zero.
 .RE
 
 .PD 1