Skip to content

Commit

Permalink
fs: return -EOPNOTSUPP if clone is not supported
Browse files Browse the repository at this point in the history
-EBADF is a rather confusing error if an operations is not supported,
and nfsd gets rather upset about it.

Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Christoph Hellwig authored and Al Viro committed Feb 28, 2016
1 parent b6853f7 commit 0fcbf99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1533,10 +1533,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;
Expand Down

0 comments on commit 0fcbf99

Please sign in to comment.