summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs42proc.c
diff options
context:
space:
mode:
authorOlga Kornievskaia <kolga@netapp.com>2019-07-02 20:57:25 +0200
committerOlga Kornievskaia <olga.kornievskaia@gmail.com>2019-10-09 18:06:10 +0200
commit124060255d59b45fb0d19149d61530ad89d8fd1c (patch)
tree9bef123ec45e1bbaba53a08d5a694ff3e93d5e99 /fs/nfs/nfs42proc.c
parentNFS: COPY handle ERR_OFFLOAD_DENIED (diff)
downloadlinux-124060255d59b45fb0d19149d61530ad89d8fd1c.tar.xz
linux-124060255d59b45fb0d19149d61530ad89d8fd1c.zip
NFS: also send OFFLOAD_CANCEL to source server
In case of copy is cancelled, also send OFFLOAD_CANCEL to the source server. Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Diffstat (limited to 'fs/nfs/nfs42proc.c')
-rw-r--r--fs/nfs/nfs42proc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 50538b975aba..5d833f5748e9 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -206,12 +206,14 @@ out:
memcpy(&res->write_res.verifier, &copy->verf, sizeof(copy->verf));
status = -copy->error;
+out_free:
kfree(copy);
return status;
out_cancel:
nfs42_do_offload_cancel_async(dst, &copy->stateid);
- kfree(copy);
- return status;
+ if (!nfs42_files_from_same_server(src, dst))
+ nfs42_do_offload_cancel_async(src, src_stateid);
+ goto out_free;
}
static int process_copy_commit(struct file *dst, loff_t pos_dst,
@@ -381,7 +383,8 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src,
if (err >= 0)
break;
- if (err == -ENOTSUPP) {
+ if (err == -ENOTSUPP &&
+ nfs42_files_from_same_server(src, dst)) {
err = -EOPNOTSUPP;
break;
} else if (err == -EAGAIN) {
@@ -392,7 +395,8 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src,
dst_exception.retry = 1;
continue;
} else if ((err == -ESTALE ||
- err == -NFS4ERR_OFFLOAD_DENIED) &&
+ err == -NFS4ERR_OFFLOAD_DENIED ||
+ err == -ENOTSUPP) &&
!nfs42_files_from_same_server(src, dst)) {
nfs42_do_offload_cancel_async(src, &args.src_stateid);
err = -EOPNOTSUPP;