Merge branch 'work.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-block.git] / fs / xfs / scrub / parent.c
index 0d3851410c74feae8ffb5001a34568f47e177c4b..1fb88c18d455c9d5c2ae6da875ba3754819136c5 100644 (file)
@@ -167,8 +167,18 @@ xfs_scrub_parent_validate(
         * if the parent pointer erroneously points to a file, we
         * can't use DONTCACHE here because DONTCACHE inodes can trigger
         * immediate inactive cleanup of the inode.
+        *
+        * If _iget returns -EINVAL then the parent inode number is garbage
+        * and the directory is corrupt.  If the _iget returns -EFSCORRUPTED
+        * or -EFSBADCRC then the parent is corrupt which is a cross
+        * referencing error.  Any other error is an operational error.
         */
-       error = xfs_iget(mp, sc->tp, dnum, 0, 0, &dp);
+       error = xfs_iget(mp, sc->tp, dnum, XFS_IGET_UNTRUSTED, 0, &dp);
+       if (error == -EINVAL) {
+               error = -EFSCORRUPTED;
+               xfs_scrub_fblock_process_error(sc, XFS_DATA_FORK, 0, &error);
+               goto out;
+       }
        if (!xfs_scrub_fblock_xref_process_error(sc, XFS_DATA_FORK, 0, &error))
                goto out;
        if (dp == sc->ip || !S_ISDIR(VFS_I(dp)->i_mode)) {