All of lore.kernel.org
 help / color / mirror / Atom feed
* a late clone fix
@ 2016-02-26 17:53 Christoph Hellwig
  2016-02-26 17:53 ` [PATCH] fs: return -EOPNOTSUPP if clone is not supported Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2016-02-26 17:53 UTC (permalink / raw)
  To: viro; +Cc: darrick.wong, linux-fsdevel

Not sure why I messed up the return value for a missing clone_file_range
method, but EBADF is a really bad choice.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] fs: return -EOPNOTSUPP if clone is not supported
  2016-02-26 17:53 a late clone fix Christoph Hellwig
@ 2016-02-26 17:53 ` Christoph Hellwig
  2016-02-26 21:51   ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2016-02-26 17:53 UTC (permalink / raw)
  To: viro; +Cc: darrick.wong, linux-fsdevel

-EBADF is a rather confusing error if an operations is not supported,
and nfsd gets rather upset about it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fs: return -EOPNOTSUPP if clone is not supported
  2016-02-26 17:53 ` [PATCH] fs: return -EOPNOTSUPP if clone is not supported Christoph Hellwig
@ 2016-02-26 21:51   ` Darrick J. Wong
  0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2016-02-26 21:51 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: viro, linux-fsdevel

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@oracle.com>

--D

> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-26 21:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 17:53 a late clone fix Christoph Hellwig
2016-02-26 17:53 ` [PATCH] fs: return -EOPNOTSUPP if clone is not supported Christoph Hellwig
2016-02-26 21:51   ` Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.