From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J. Bruce Fields" Subject: Re: [PATCH 2/3] EXPORTFS: Have fh_to_*() return -ESTALE if the file handle type is unrecognised [try #2] Date: Thu, 4 Dec 2008 14:31:02 -0500 Message-ID: <20081204193102.GC7575@fieldses.org> References: <20081203183033.2636.47937.stgit@warthog.procyon.org.uk> <20081203183038.2636.74428.stgit@warthog.procyon.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: hch@infradead.org, viro@ZenIV.linux.org.uk, linux-fsdevel@vger.kernel.org To: David Howells Return-path: Received: from mail.fieldses.org ([66.93.2.214]:48811 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753922AbYLDTbJ (ORCPT ); Thu, 4 Dec 2008 14:31:09 -0500 Content-Disposition: inline In-Reply-To: <20081203183038.2636.74428.stgit@warthog.procyon.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Dec 03, 2008 at 06:30:38PM +0000, David Howells wrote: > 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); It looks like d_obtain_alias already returns -ESTALE in this case, not a negative dentry. > @@ -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); Ditto here, and in the other two cases. I don't understand what you're doing. --b. > 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); > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html