Subject: [nfsv4] NFSv4.2 DEALLOCATE semantics for some da_offset+da_length arguments?

From: Rick Macklem <[email-masked]>
Date: Wed, 11 Aug 2021 00:00:22 +0000

Hi,

I am implementing the NFSv4.2 Deallocate operation and am wondering
about a couple of cases for da_offset+da_length?

1 - da_offset + da_length <= UINT64_MAX but > file Size.
     --> I think the answer is probably return NFS_OK with a hole punched
            as far as file Size. RFC7862 states that file Size does not change,
            but it also states "All further READs from the region passed to
            DEALLOCATE MUST return zeros until overwritten.".
      Should the above sentence be "All further READs from the region passed
       to DEALLOCATE up to the file's size attribute MUST return zeros until
       overwritten."?
I think allowing this case is preferred to replying an NFS4ERR_INVAL, since
the size attribute might change via a Setattr of size done by another client
at any time, but I don't have a strong opinion.
What do others think?

2 - da_offset + da_length > UINT64_MAX.
     Should this result in an NFS4ERR_INVAL reply or should the server simply
     truncate da_length so that da_offset + da_length == UINT64_MAX and
     then do the hole punch?

rick

---

From: Rick Macklem <[email-masked]>
Date: Sun, 22 Aug 2021 23:14:28 +0000

Since I haven't seen any replies to the original post, I've
tested against the Linux 5.12 kernel and implemented what
I believe is the semantics it exhibits.

if da_length == 0
     reply NFS4ERR_INVAL
if da_offset + da_length > UINT64_MAX (ie. overflows 64bits)
     reply NFS4ERR_INVAL
if da_offset + da_length > maxfilesize attribute
     reply NFS4ERR_FBIG
otherwise reply NFS_OK after
--> if da_offset >= size attribute
          - a no-op
       if da_offset + da_length > size attribute
          - zeroing to size (EOF)
       else
           - zeroing out the full range.

Does anyone think the above is incorrect or know of a
NFSv4.2 server that implements Deallocate differently
w.r.t. the da_offset and da_length arguments?

I am particularily concerned that there might be a
NFSv4.2 server implementation of Deallocate that
would consider "da_offset + da_length > size attribute"
an error and return an NFS4ERR_xxx instead of NFS_OK
plus zeroing to EOF.

rick

________________________________________
From: nfsv4 <[email-masked]> on behalf of Rick Macklem <[email-masked]>
Sent: Tuesday, August 10, 2021 8:00 PM
To: [email-masked]
Subject: [nfsv4] NFSv4.2 DEALLOCATE semantics for some da_offset+da_length arguments?

Hi,

rick

_______________________________________________
nfsv4 mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/nfsv4