Bug 227214

Summary: ESXi NFSv4.1 client sets bits in OpenDowngrade not recognized by the FreeBSD server
Product: Base System Reporter: Rick Macklem <rmacklem>
Component: kernAssignee: Rick Macklem <rmacklem>
Status: Closed FIXED    
Severity: Affects Some People Flags: rmacklem: mfc-stable11+
rmacklem: mfc-stable10+
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Fix OpenDowngrade to clear bits defined for NFSv4.1 that were not in NFSv4.0
none
Fix OpenDowngrade to clear want bits and allow adding of deny bits none

Description Rick Macklem freebsd_committer freebsd_triage 2018-04-02 22:04:07 UTC
Created attachment 192123 [details]
Fix OpenDowngrade to clear bits defined for NFSv4.1 that were not in NFSv4.0
Comment 1 Rick Macklem freebsd_committer freebsd_triage 2018-04-02 22:07:22 UTC
When "delegation wanted" bits are set in the share_access argument
for OpenDowngrade, the FreeBSD server would reply a BADXDR failure.
For NFSv4.1, this is allowed and the bits are just ignored.
The attached patch clears these bits and also changes the error
returned for extraneous bits set to NFSERR_INVAL, which is the
error specified for NFSv4.1 by RFC-5661. (NFSv4.0 did not specify
what error should be returned for this case.)
Comment 2 Rick Macklem freebsd_committer freebsd_triage 2018-04-19 20:18:08 UTC
Created attachment 192667 [details]
Fix OpenDowngrade to clear want bits and allow adding of deny bits

This updated version of the OpenDowngrade patch allows the OpenDowngrade
to add open_share_deny bits. The RFCs are vague on whether or not this is
allowed, but since the EXSi 6.5 client wants to do this and it reduces
access permissions, I think allowing it makes sense.
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-04-19 20:31:21 UTC
A commit references this bug:

Author: rmacklem
Date: Thu Apr 19 20:30:34 UTC 2018
New revision: 332790
URL: https://svnweb.freebsd.org/changeset/base/332790

Log:
  Fix OpenDowngrade for NFSv4.1 if a client sets the OPEN_SHARE_ACCESS_WANT* bits.

  The NFSv4.1 RFC specifies that the OPEN_SHARE_ACCESS_WANT bits can be set
  in the OpenDowngrade share_access argument and are basically ignored.
  I do not know of a extant NFSv4.1 client that does this, but this little
  patch fixes it just in case.
  It also changes the error from NFSERR_BADXDR to NFSERR_INVAL since the NFSv4.1
  RFC specifies this as the error to be returned if bogus bits are set.
  (The NFSv4.0 RFC didn't specify any error for this, so the error reply can
   be changed for NFSv4.0 as well.)
  Found by inspection while looking at a problem with OpenDowngrade reported
  for the ESXi 6.5 NFSv4.1 client.

  Reported by:	andreas.nagy@frequentis.com
  PR:		227214
  MFC after:	1 week

Changes:
  head/sys/fs/nfsserver/nfs_nfsdserv.c
Comment 4 Rick Macklem freebsd_committer freebsd_triage 2018-07-23 01:50:30 UTC
The commit for the part that clears the OPEN_SHARE_WANT_xx flags has
been MFC'd. The other part of this patch violates RFC-5661 and does
not appear to be needed for ESXi 6.7, so it won't be committed.