xfs: distinguish between corrupt inode and invalid inum in xfs_scrub_get_inode
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 8 Jan 2018 18:49:04 +0000 (10:49 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 8 Jan 2018 18:49:04 +0000 (10:49 -0800)
commitd658e72b4a09c0eb65c13fc5c15bc6e6d93ed8bc
treefcc2b1c8080527cc3c041bae00376b98bbddea59
parent1ad1205e716fa2a88ca960601cc807cd38853c01
xfs: distinguish between corrupt inode and invalid inum in xfs_scrub_get_inode

In xfs_scrub_get_inode, we don't do a good enough job distinguishing
EINVAL returns from xfs_iget w/ IGET_UNTRUSTED -- this can happen if the
passed in inode number is invalid (past eofs, inobt says it isn't an
inode) or if the inum is actually valid but the inode buffer fails
verifier.  In the first case we still want to return ENOENT, but in the
second case we want to capture the corruption error.

Therefore, if xfs_iget returns EINVAL, try the raw imap lookup.  If that
succeeds, we conclude it's a corruption error, otherwise we just bounce
out to userspace.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/scrub/common.c