Re: [PATCH -V20 01/12] exportfs: Return the minimum required handle size

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

 



On Wed, Sep 29, 2010 at 01:06:39AM +0530, Aneesh Kumar K.V wrote:
> The exportfs encode handle function should return the minimum required
> handle size. This helps user to find out the handle size by passing 0
> handle size in the first step and then redoing to the call again with
> the returned handle size value.

Just nits; seems OK otherwise:

> diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c
> index 19ad145..250a347 100644
> --- a/fs/ocfs2/export.c
> +++ b/fs/ocfs2/export.c
> @@ -201,8 +201,14 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len,
>  		   dentry->d_name.len, dentry->d_name.name,
>  		   fh, len, connectable);
>  
> -	if (len < 3 || (connectable && len < 6)) {
> +	if (connectable && (len < 6)) {
>  		mlog(ML_ERROR, "fh buffer is too small for encoding\n");

Should that really be a printk(KERN_ERR, ...) if this is an expected use
of the interface?

> +		*max_len = 6;
> +		type = 255;
> +		goto bail;
> +	} else if (len < 3) {
> +		mlog(ML_ERROR, "fh buffer is too small for encoding\n");

Ditto.

> +		*max_len = 3;
>  		type = 255;
>  		goto bail;
>  	}
> diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
> index a9cd507..acd0b2d 100644
> --- a/include/linux/exportfs.h
> +++ b/include/linux/exportfs.h
> @@ -108,8 +108,10 @@ struct fid {
>   *    set, the encode_fh() should store sufficient information so that a good
>   *    attempt can be made to find not only the file but also it's place in the
>   *    filesystem.   This typically means storing a reference to de->d_parent in
> - *    the filehandle fragment.  encode_fh() should return the number of bytes
> - *    stored or a negative error code such as %-ENOSPC
> + *    the filehandle fragment.  encode_fh() should return the fileid_type on
> + *    success and on error returns 255 (if the space needed to encode fh is
> + *    greater than @max_len*4 bytes). On error @max_len contain the minimum

s/contain/contains/.

> + *    size(in 4 byte unit) needed to encode the file handle.
>   *
>   * fh_to_dentry:
>   *    @fh_to_dentry is given a &struct super_block (@sb) and a file handle

--b.
--
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