Skip to main content
NetApp Knowledge Base

How is Mandatory Locking supported for NFSv4 on ONTAP 9?

Views:
2,105
Visibility:
Public
Votes:
2
Category:
ontap-9
Specialty:
nas
Last Updated:

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.
         
    • 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.

Additional Information

  • Example of Mandatory share reservation locking

Mandatory.png

  • 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.

 

NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.