From: David Howells Subject: [PATCH 2/3] EXPORTFS: Have fh_to_*() return -ESTALE if the file handle type is unrecognised [try #2] Date: Wed, 03 Dec 2008 18:30:38 +0000 Message-ID: <20081203183038.2636.74428.stgit@warthog.procyon.org.uk> References: <20081203183033.2636.47937.stgit@warthog.procyon.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org To: hch@infradead.org, viro@ZenIV.linux.org.uk Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33734 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751672AbYLCSan (ORCPT ); Wed, 3 Dec 2008 13:30:43 -0500 In-Reply-To: <20081203183033.2636.47937.stgit@warthog.procyon.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Make fh_to_dentry() and fh_to_parent() operations return -ESTALE rather than a negative dentry if the file handle type is unrecognised. Signed-off-by: David Howells --- fs/libfs.c | 4 ++++ fs/xfs/linux-2.6/xfs_export.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 4fe5b5b..47952f2 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -758,6 +758,8 @@ struct dentry *generic_fh_to_dentry(struct super_block *sb, struct fid *fid, case FILEID_INO32_GEN_PARENT: inode = get_inode(sb, fid->i32.ino, fid->i32.gen); break; + default: + return ERR_PTR(-ESTALE); } return d_obtain_alias(inode); @@ -791,6 +793,8 @@ struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, inode = get_inode(sb, fid->i32.parent_ino, (fh_len > 3 ? fid->i32.parent_gen : 0)); break; + default: + return ERR_PTR(-ESTALE); } return d_obtain_alias(inode); diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c index f9a51c4..7a4c75f 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/linux-2.6/xfs_export.c @@ -161,6 +161,8 @@ xfs_fs_fh_to_dentry(struct super_block *sb, struct fid *fid, case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG: inode = xfs_nfs_get_inode(sb, fid64->ino, fid64->gen); break; + default: + return ERR_PTR(-ESTALE); } return d_obtain_alias(inode); @@ -182,6 +184,8 @@ xfs_fs_fh_to_parent(struct super_block *sb, struct fid *fid, inode = xfs_nfs_get_inode(sb, fid64->parent_ino, fid64->parent_gen); break; + default: + return ERR_PTR(-ESTALE); } return d_obtain_alias(inode);