Subject: [nfsv4] [PATCH 0/2] CLONE nit picking

From: Benny Halevy <[email-masked]>
Date: Mon, 20 Apr 2015 12:29:22 +0300

Following are a couple of minor fixes in CLONE

[PATCH 1/2] Fix cut-n-paste typos in CLONE
Fixes text apparently copied verbatim from COPY's specification

[PATCH 2/2] Allow CLONE to return NFS4ERR_LOCKED
Source or destination files might be locked

---

From: Benny Halevy <[email-masked]>
Date: Mon, 20 Apr 2015 14:19:31 +0300

Signed-off-by: Benny Halevy <[email-masked]>
---
 nfsv42_middle_op_clone.xml | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/nfsv42_middle_op_clone.xml b/nfsv42_middle_op_clone.xml
index f93e78d..49331e5 100644
--- a/nfsv42_middle_op_clone.xml
+++ b/nfsv42_middle_op_clone.xml
@@ -78,10 +78,23 @@
       An offset of 0 (zero) specifies the start of the file. A count
       of 0 (zero) requests that all bytes from ca_src_offset through
       EOF be cloned to the destination. Both cl_src_offset and
-      cl_dst_offset must be aligned to the clone block size
-      <xref target='ss:fattr:clone' />.  cl_count must be aligned to
-      the clone block size, unless cl_src_offset + cl_count are
+      cl_dst_offset must be aligned to the clone block sizes
+      <xref target='ss:fattr:clone' />
+      of the source and destination files, respectively.
+      Similarly, cl_count must be aligned to
+      the files' clone block size, unless cl_src_offset + cl_count are
       equal to the source file size.
+      Otherwise, errors in alignment will result in NFS4ERR_INVAL.
+    </t>
+
+    <t>
+      In cases where the cloning of the requested byte range
+      is not allowed due to different source and destination clone
+      block sizes or other server cross-domain constraints
+      NFS4ERR_XDEV will result.
+      However, the server SHOULD allow to clone the whole source file
+      to an empty, newly created destination file
+      despite different clone block size values.
     </t>
 
     <t>
-- 
1.8.3.1

---

From: Benny Halevy <[email-masked]>
Date: Mon, 20 Apr 2015 14:21:28 +0300

Signed-off-by: Benny Halevy <[email-masked]>
---
 nfsv42_middle_op_clone.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nfsv42_middle_op_clone.xml b/nfsv42_middle_op_clone.xml
index 7806590..f93e78d 100644
--- a/nfsv42_middle_op_clone.xml
+++ b/nfsv42_middle_op_clone.xml
@@ -48,7 +48,7 @@
 
     <t>
       In order to set SAVED_FH to the source file handle, the
-      compound procedure requesting the COPY will include a
+      compound procedure requesting the CLONE will include a
       sub-sequence of operations such as
     </t>
 
@@ -92,7 +92,7 @@
     </t>
 
     <t>
-      If the COPY wrote past the end of the file on the destination, then the
+      If the CLONE wrote past the end of the file on the destination, then the
       last byte written to will determine the new file size. The contents of
       any block not written to and past the original size of the file will be
       as if a normal WRITE extended the file.
-- 
1.8.3.1

---

From: Benny Halevy <[email-masked]>
Date: Mon, 20 Apr 2015 14:21:42 +0300

CLONE may fail when either destination or source file is locked.

Signed-off-by: Benny Halevy <[email-masked]>
---
 nfsv42_middle_errors.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nfsv42_middle_errors.xml b/nfsv42_middle_errors.xml
index 6da7442..cd2cd68 100644
--- a/nfsv42_middle_errors.xml
+++ b/nfsv42_middle_errors.xml
@@ -1429,6 +1429,7 @@
         NFS4ERR_INVAL,
         NFS4ERR_IO,
         NFS4ERR_ISDIR,
+        NFS4ERR_LOCKED,
         NFS4ERR_MOVED,
         NFS4ERR_NOFILEHANDLE,
         NFS4ERR_NOTSUPP,
-- 
1.8.3.1

---

From: Christoph Hellwig <[email-masked]>
Date: Mon, 20 Apr 2015 14:49:27 +0200

All the changes look good to me, thanks!

---

From: Tom Haynes <[email-masked]>
Date: Wed, 22 Apr 2015 10:53:36 -0700

> All the changes look good to me, thanks!

Applied