NFS: for "inter" copy treat ESTALE as ENOTSUPP
authorOlga Kornievskaia <kolga@netapp.com>
Mon, 25 Sep 2017 19:59:44 +0000 (15:59 -0400)
committerOlga Kornievskaia <olga.kornievskaia@gmail.com>
Wed, 9 Oct 2019 16:06:00 +0000 (12:06 -0400)
If the client sends an "inter" copy to the destination server but
it only supports "intra" copy, it can return ESTALE (since it
doesn't know anything about the file handle from the other server
and does not recognize the special case of "inter" copy). Translate
this error as ENOTSUPP and also send OFFLOAD_CANCEL to the source
server so that it can clean up state.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
fs/nfs/nfs42proc.c

index e34ade8..6ed5a16 100644 (file)
@@ -391,6 +391,11 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src,
                        args.sync = true;
                        dst_exception.retry = 1;
                        continue;
+               } else if (err == -ESTALE &&
+                               !nfs42_files_from_same_server(src, dst)) {
+                       nfs42_do_offload_cancel_async(src, &args.src_stateid);
+                       err = -EOPNOTSUPP;
+                       break;
                }
 
                err2 = nfs4_handle_exception(server, err, &src_exception);