Re: [PATCH] fs: return -EOPNOTSUPP if clone is not supported

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

 



On Fri, Feb 26, 2016 at 06:53:12PM +0100, Christoph Hellwig wrote:
> -EBADF is a rather confusing error if an operations is not supported,
> and nfsd gets rather upset about it.

I was wondering why I kept getting EBADF trying to run xfstests over NFS
before I figured out to pass -o nfsvers=4.2 to mount.

Anyhow,
Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

--D

> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  fs/read_write.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/read_write.c b/fs/read_write.c
> index 324ec27..1cdfdfe 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -1532,10 +1532,12 @@ int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
>  
>  	if (!(file_in->f_mode & FMODE_READ) ||
>  	    !(file_out->f_mode & FMODE_WRITE) ||
> -	    (file_out->f_flags & O_APPEND) ||
> -	    !file_in->f_op->clone_file_range)
> +	    (file_out->f_flags & O_APPEND))
>  		return -EBADF;
>  
> +	if (!file_in->f_op->clone_file_range)
> +		return -EOPNOTSUPP;
> +
>  	ret = clone_verify_area(file_in, pos_in, len, false);
>  	if (ret)
>  		return ret;
> -- 
> 2.1.4
> 
--
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