[PATCH v2 02/10] NFS fallback to generic_copy_file_range

Olga Kornievskaia
2018-11-30T20:03:57Z

If NFS unable to handle the copy then fallback to the generic VFS
copy_file_range functionality.

Also remove the offset check, as the check was added at the VFS.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
fs/nfs/nfs4file.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 4fe9fc1..78e163a 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -139,17 +139,16 @@ static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in,
nfs4_stateid *cnrs = NULL;
ssize_t ret;

- if (pos_in >= i_size_read(file_inode(file_in)))
- return -EINVAL;
-
if (file_in->f_op != &nfs4_file_operations)
- return -EXDEV;
+ return generic_copy_file_range(file_in, pos_in, file_out,
+ pos_out, count, flags);

if (file_inode(file_in) == file_inode(file_out))
return -EINVAL;

if (!nfs_server_capable(file_inode(file_out), NFS_CAP_COPY))
- return -EOPNOTSUPP;
+ return generic_copy_file_range(file_in, pos_in, file_out,
+ pos_out, count, flags);
retry:
if (!nfs42_files_from_same_server(file_in, file_out)) {
cn_resp = kzalloc(sizeof(struct nfs42_copy_notify_res),
--
1.8.3.1