While debugging another NFSv3 problem this week, I came across a create procedure with the “GUARDED” flag set:
snoop -d hme0 host netapp1
yappy -> netapp1 NFS C CREATE3 FH=C5D2 (GUARDED) file.dat netapp1 -> yappy NFS R CREATE3 OK FH=E700
This was the first time I have reviewed an NFSv3 packet capture with the GUARDED flag set, so I decided to read RFC 1813 to see how the create procedure should be implemented. Here is what the RFC says about the GUARDED flag:
“Creation modes: One of UNCHECKED, GUARDED, and EXCLUSIVE. UNCHECKED means that the file should be created without checking for the existence of a duplicate file in the same directory. In this case, how.obj_attributes is a sattr3 describing the initial attributes for the file. GUARDED specifies that the server should check for the presence of a duplicate file before performing the create and should fail the request with NFS3ERR_EXIST if a duplicate file exists. If the file does not exist, the request is performed as described for UNCHECKED. EXCLUSIVE specifies that the server is to follow exclusive creation semantics, using the verifier to ensure exclusive creation of the target. No attributes may be provided in this case, since the server may use the target file metadata to store the createverf3 verifier.”*
This is rather interesting, and it makes sense given that the mode passed as the second argument to creat() should be transparently passed through to the NFSv3 create procedure. RFC 1813 is extremely well writtten, and a great read if your looking to learn more about NFS!