summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-04-22 19:48:05 +0300
committerDarrick J. Wong <djwong@kernel.org>2024-04-23 17:47:03 +0300
commit59a2af9086f0d60fc8de7346da67db7d764c7221 (patch)
tree886fe8740874d735a38008faf983c9d27b4d7ca2 /fs
parent77ede5f44b0d86c2ec812442846f512884009766 (diff)
downloadlinux-59a2af9086f0d60fc8de7346da67db7d764c7221.tar.xz
xfs: check parent pointer xattrs when scrubbing
Check parent pointer xattrs as part of scrubbing xattrs. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/scrub/attr.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index 393ed36709b3..b550f3e34ffc 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"
@@ -208,6 +209,13 @@ xchk_xattr_actor(
return -ECANCELED;
}
+ /* Check parent pointer record. */
+ if ((attr_flags & XFS_ATTR_PARENT) &&
+ !xfs_parent_valuecheck(sc->mp, value, valuelen)) {
+ xchk_fblock_set_corrupt(sc, XFS_ATTR_FORK, args.blkno);
+ return -ECANCELED;
+ }
+
/*
* Try to allocate enough memory to extract the attr value. If that
* doesn't work, return -EDEADLOCK as a signal to try again with a
@@ -219,6 +227,14 @@ xchk_xattr_actor(
if (error)
return error;
+ /*
+ * Parent pointers are matched on attr name and value, so we must
+ * supply the xfs_parent_rec here when confirming that the dabtree
+ * indexing works correctly.
+ */
+ if (attr_flags & XFS_ATTR_PARENT)
+ memcpy(ab->value, value, valuelen);
+
args.value = ab->value;
/*