linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Alex Elder <aelder@sgi.com>, xfs-masters@oss.sgi.com
Cc: xfs@oss.sgi.com, linux-nfs@vger.kernel.org
Subject: [PATCH] xfs: failure mapping nfs fh to inode should return ESTALE
Date: Thu, 14 Jul 2011 16:50:36 -0400	[thread overview]
Message-ID: <20110714205036.GA19457@fieldses.org> (raw)

From: J. Bruce Fields <bfields@redhat.com>

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>
---
 fs/xfs/linux-2.6/xfs_export.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index f4f878f..75e5d32 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -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);
-- 
1.7.4.1


             reply	other threads:[~2011-07-14 20:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14 20:50 J. Bruce Fields [this message]
2011-07-14 22:25 ` [PATCH] xfs: failure mapping nfs fh to inode should return ESTALE Alex Elder
2011-07-14 22:31 ` Christoph Hellwig
2011-07-15 20:33   ` J. Bruce Fields
2011-07-16  1:50   ` [xfs-masters] " Dave Chinner
2011-07-16  1:53     ` Christoph Hellwig
2011-07-18 13:37       ` J. Bruce Fields
2011-07-19 19:29         ` Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110714205036.GA19457@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=aelder@sgi.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=xfs-masters@oss.sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).