Skip to content

Commit

Permalink
NFS: also send OFFLOAD_CANCEL to source server
Browse files Browse the repository at this point in the history
In case of copy is cancelled, also send OFFLOAD_CANCEL to the source
server.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
  • Loading branch information
olgakorn1 authored and Olga Kornievskaia committed Oct 9, 2019
1 parent 6b61c96 commit 1240602
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fs/nfs/nfs42proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@ static int handle_async_copy(struct nfs42_copy_res *res,
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,
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 1240602

Please sign in to comment.