Commit b3c03efa authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: check metadata directory file path connectivity



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.  For example, check that "/quota/user" in
the metadata directory tree actually points to
mp->m_quotainfo->qi_uquotaip->i_ino.

Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 9dc31acb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ xfs-y += $(addprefix scrub/, \
				   inode.o \
				   iscan.o \
				   listxattr.o \
				   metapath.o \
				   nlinks.o \
				   parent.o \
				   readdir.o \
+12 −1
Original line number Diff line number Diff line
@@ -199,6 +199,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
 */
+3 −1
Original line number Diff line number Diff line
@@ -63,6 +63,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 */
@@ -107,7 +108,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)
+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ int xchk_setup_xattr(struct xfs_scrub *sc);
int xchk_setup_symlink(struct xfs_scrub *sc);
int xchk_setup_parent(struct xfs_scrub *sc);
int xchk_setup_dirtree(struct xfs_scrub *sc);
int xchk_setup_metapath(struct xfs_scrub *sc);
#ifdef CONFIG_XFS_RT
int xchk_setup_rtbitmap(struct xfs_scrub *sc);
int xchk_setup_rtsummary(struct xfs_scrub *sc);
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ static const struct xchk_health_map type_to_health_flag[XFS_SCRUB_TYPE_NR] = {
	[XFS_SCRUB_TYPE_QUOTACHECK]	= { XHG_FS,  XFS_SICK_FS_QUOTACHECK },
	[XFS_SCRUB_TYPE_NLINKS]		= { XHG_FS,  XFS_SICK_FS_NLINKS },
	[XFS_SCRUB_TYPE_DIRTREE]	= { XHG_INO, XFS_SICK_INO_DIRTREE },
	[XFS_SCRUB_TYPE_METAPATH]	= { XHG_FS,  XFS_SICK_FS_METAPATH },
};

/* Return the health status mask for this scrub type. */
Loading