From: Darrick J. Wong <djwong@xxxxxxxxxx> Check parent pointer xattrs as part of scrubbing xattrs. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- fs/xfs/scrub/attr.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c index 2ad109fdd1998..46cc284deaac9 100644 --- a/fs/xfs/scrub/attr.c +++ b/fs/xfs/scrub/attr.c @@ -17,6 +17,7 @@ #include "xfs_attr.h" #include "xfs_attr_leaf.h" #include "xfs_attr_sf.h" +#include "xfs_parent.h" #include "scrub/scrub.h" #include "scrub/common.h" #include "scrub/dabtree.h" @@ -205,6 +206,19 @@ xchk_xattr_actor( return -ECANCELED; } + /* Check parent pointer geometry. */ + if (attr_flags & XFS_ATTR_PARENT) { + if (!xfs_has_parent(sc->mp)) { + xchk_fblock_set_corrupt(sc, XFS_ATTR_FORK, args.blkno); + return -ECANCELED; + } + + if (!xfs_parent_valuecheck(sc->mp, value, valuelen)) { + xchk_fblock_set_corrupt(sc, XFS_ATTR_FORK, args.blkno); + return -ECANCELED; + } + } + /* Does this name make sense? */ if (!xfs_attr_namecheck(sc->mp, name, namelen, attr_flags)) { xchk_fblock_set_corrupt(sc, XFS_ATTR_FORK, args.blkno);