xfs: xfs_iget in the directory scrubber needs to use UNTRUSTED
authorDarrick J. Wong <djwong@kernel.org>
Wed, 12 Apr 2023 02:00:17 +0000 (19:00 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 12 Apr 2023 02:00:17 +0000 (19:00 -0700)
commitd9a94480f978d5fbf1235a12a476f9f39a029ea5
tree58135b0f1335e553ca9cd4bbe568b9c30179ce0a
parent4c233b5c4f29dff11eeb64b2b1cc0831b9904a4f
xfs: xfs_iget in the directory scrubber needs to use UNTRUSTED

In commit 4b80ac64450f, we tried to strengthen the directory scrubber by
using the iget call to detect directory entries that point to
unallocated inodes.  Unfortunately, that commit neglected to pass
XFS_IGET_UNTRUSTED to xfs_iget, so we don't check the inode btree first.
If the inode number points to something that isn't even an inode
cluster, iget will throw corruption errors and return -EFSCORRUPTED,
which means that we fail to mark the directory corrupt.

Fixes: 4b80ac64450f ("xfs: scrub should mark a directory corrupt if any entries cannot be iget'd")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/scrub/dir.c