Skip to content

Commit 59a2af9

Browse files
author
Darrick J. Wong
committed
xfs: check parent pointer xattrs when scrubbing
Check parent pointer xattrs as part of scrubbing xattrs. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 77ede5f commit 59a2af9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

fs/xfs/scrub/attr.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "xfs_attr.h"
1818
#include "xfs_attr_leaf.h"
1919
#include "xfs_attr_sf.h"
20+
#include "xfs_parent.h"
2021
#include "scrub/scrub.h"
2122
#include "scrub/common.h"
2223
#include "scrub/dabtree.h"
@@ -208,6 +209,13 @@ xchk_xattr_actor(
208209
return -ECANCELED;
209210
}
210211

212+
/* Check parent pointer record. */
213+
if ((attr_flags & XFS_ATTR_PARENT) &&
214+
!xfs_parent_valuecheck(sc->mp, value, valuelen)) {
215+
xchk_fblock_set_corrupt(sc, XFS_ATTR_FORK, args.blkno);
216+
return -ECANCELED;
217+
}
218+
211219
/*
212220
* Try to allocate enough memory to extract the attr value. If that
213221
* doesn't work, return -EDEADLOCK as a signal to try again with a
@@ -219,6 +227,14 @@ xchk_xattr_actor(
219227
if (error)
220228
return error;
221229

230+
/*
231+
* Parent pointers are matched on attr name and value, so we must
232+
* supply the xfs_parent_rec here when confirming that the dabtree
233+
* indexing works correctly.
234+
*/
235+
if (attr_flags & XFS_ATTR_PARENT)
236+
memcpy(ab->value, value, valuelen);
237+
222238
args.value = ab->value;
223239

224240
/*

0 commit comments

Comments
 (0)