From patchwork Thu Jul 14 20:50:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Bruce Fields" X-Patchwork-Id: 975762 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6EKodoD015591 for ; Thu, 14 Jul 2011 20:50:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932152Ab1GNUui (ORCPT ); Thu, 14 Jul 2011 16:50:38 -0400 Received: from fieldses.org ([174.143.236.118]:34043 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932140Ab1GNUuh (ORCPT ); Thu, 14 Jul 2011 16:50:37 -0400 Received: from bfields by fieldses.org with local (Exim 4.72) (envelope-from ) id 1QhSrl-0005I6-0U; Thu, 14 Jul 2011 16:50:37 -0400 Date: Thu, 14 Jul 2011 16:50:36 -0400 To: Alex Elder , 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 Message-ID: <20110714205036.GA19457@fieldses.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) From: "J. Bruce Fields" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 14 Jul 2011 20:50:40 +0000 (UTC) From: J. Bruce Fields 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 Reviewed-by: Alex Elder --- 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);