Skip to content

Commit 1240602

Browse files
olgakorn1Olga Kornievskaia
authored and
Olga Kornievskaia
committed
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 <[email protected]>
1 parent 6b61c96 commit 1240602

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

fs/nfs/nfs42proc.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,14 @@ static int handle_async_copy(struct nfs42_copy_res *res,
206206
memcpy(&res->write_res.verifier, &copy->verf, sizeof(copy->verf));
207207
status = -copy->error;
208208

209+
out_free:
209210
kfree(copy);
210211
return status;
211212
out_cancel:
212213
nfs42_do_offload_cancel_async(dst, &copy->stateid);
213-
kfree(copy);
214-
return status;
214+
if (!nfs42_files_from_same_server(src, dst))
215+
nfs42_do_offload_cancel_async(src, src_stateid);
216+
goto out_free;
215217
}
216218

217219
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,
381383

382384
if (err >= 0)
383385
break;
384-
if (err == -ENOTSUPP) {
386+
if (err == -ENOTSUPP &&
387+
nfs42_files_from_same_server(src, dst)) {
385388
err = -EOPNOTSUPP;
386389
break;
387390
} else if (err == -EAGAIN) {
@@ -392,7 +395,8 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src,
392395
dst_exception.retry = 1;
393396
continue;
394397
} else if ((err == -ESTALE ||
395-
err == -NFS4ERR_OFFLOAD_DENIED) &&
398+
err == -NFS4ERR_OFFLOAD_DENIED ||
399+
err == -ENOTSUPP) &&
396400
!nfs42_files_from_same_server(src, dst)) {
397401
nfs42_do_offload_cancel_async(src, &args.src_stateid);
398402
err = -EOPNOTSUPP;

0 commit comments

Comments
 (0)