Skip to content

Commit d9a9448

Browse files
author
Darrick J. Wong
committed
xfs: xfs_iget in the directory scrubber needs to use UNTRUSTED
In commit 4b80ac6, 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: 4b80ac6 ("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>
1 parent 4c233b5 commit d9a9448

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

fs/xfs/scrub/dir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ xchk_dir_check_ftype(
5757
* eofblocks cleanup (which allocates what would be a nested
5858
* transaction), we can't use DONTCACHE here because DONTCACHE
5959
* inodes can trigger immediate inactive cleanup of the inode.
60+
* Use UNTRUSTED here to check the allocation status of the inode in
61+
* the inode btrees.
6062
*
6163
* If _iget returns -EINVAL or -ENOENT then the child inode number is
6264
* garbage and the directory is corrupt. If the _iget returns
6365
* -EFSCORRUPTED or -EFSBADCRC then the child is corrupt which is a
6466
* cross referencing error. Any other error is an operational error.
6567
*/
66-
error = xfs_iget(mp, sc->tp, inum, 0, 0, &ip);
68+
error = xfs_iget(mp, sc->tp, inum, XFS_IGET_UNTRUSTED, 0, &ip);
6769
if (error == -EINVAL || error == -ENOENT) {
6870
error = -EFSCORRUPTED;
6971
xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, &error);

0 commit comments

Comments
 (0)