]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit981db305c2a7a98636cab10a0c1fa1396e98b7c6
treefcc2b1c8080527cc3c041bae00376b98bbddea59
parent8b4ee36e801be582768a2c0775528f3f96a35412
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