How is Mandatory Locking supported for NFSv4 on ONTAP 9?
Applies to
- ONTAP 9
- NFSv4
Answer
- With the introduction of NFSv4, mandatory locks are now supported by the NFS protocol and network lock manager (NLM) is no longer used for locking.
- NFSv4 supports two methods of file locking:
- Byte-Range Locks
- Share Reservation Locks
- Byte-range locks will always be advisory locks.
- ONTAP 9 does not enforce mandatory byte-range locks on NFS. All byte-range locks will be advisory and only prevent the granting of conflicting lock requests and have no effect on READ or WRITE operations.
- ONTAP 9 does not enforce mandatory byte-range locks on NFS. All byte-range locks will be advisory and only prevent the granting of conflicting lock requests and have no effect on READ or WRITE operations.
- Share reservation locks will always be mandatory locks.
- Share reservation locks exist on the entire file. They are acquired during an OPEN, and are used for READ, WRITE, and SETATTR access checks. CLOSE is used to reclaim share reservation locks and reclaim resources.
- NFSv4 supports two methods of file locking:
Additional Information
- Example of Mandatory share reservation locking
- In packet 38, the client opens the file and sets share_deny to deny Write requests
- When a conflicting Write request comes in with a different state ID (all zeros) in packet 44, it receives NFS4ERR_LOCKED.
- For more information, see RFC 5661.