Skip to content

Commit

Permalink
xfs: failure mapping nfs fh to inode should return ESTALE
Browse files Browse the repository at this point in the history
On xfs exports, nfsd is incorrectly returning ENOENT instead of
ESTALE on attempts to use a filehandle of a deleted file (spotted
with pynfs test PUTFH3).  The ENOENT was coming from xfs_iget.

(It's tempting to wonder whether we should just map all xfs_iget
errors to ESTALE, but I don't believe so--xfs_iget can also return
ENOMEM at least, which we wouldn't want mapped to ESTALE.)

While we're at it, the other return of ENOENT in xfs_nfs_get_inode()
also looks wrong.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
  • Loading branch information
J. Bruce Fields authored and Alex Elder committed Jul 20, 2011
1 parent adab0f6 commit ad1a2c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/xfs/linux-2.6/xfs_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ xfs_nfs_get_inode(
* We don't use ESTALE directly down the chain to not
* confuse applications using bulkstat that expect EINVAL.
*/
if (error == EINVAL)
if (error == EINVAL || error == ENOENT)
error = ESTALE;
return ERR_PTR(-error);
}

if (ip->i_d.di_gen != generation) {
IRELE(ip);
return ERR_PTR(-ENOENT);
return ERR_PTR(-ESTALE);
}

return VFS_I(ip);
Expand Down

0 comments on commit ad1a2c8

Please sign in to comment.