Re: [PATCH 2/3] EXPORTFS: Have fh_to_*() return -ESTALE if the file handle type is unrecognised [try #2]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <dhowells@xxxxxxxxxx>
> ---
> 
>  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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux