Skip to main content
NetApp Knowledge Base

Are exclusive locks implemented in the ONTAP file system using the fcntl or the LockFileEx ?

Views:
Visibility:
Public
Votes:
0
Category:
ontap-9
Specialty:
nas
Last Updated:

Applies to

ONTAP 9

Answer

  • No,ONTAP file system does not provide exclusive locking at the file system level using fcntl or LockFileEx.
  • For NFSv3 access, file locking is managed by Network Lock Manager (NLM). 
    • NLM provides advisory locks only.
    • Advisory locks require client applications to check and honor locks.
    • Clients may access locked files or regions if the application does not check the lock.
  • For NFSv4.x, mandatory locking is supported via the Share Reservation Lock mechanism. 
    • Share Reservation Lock is enforced at the protocol level.
    • When a file is locked with Share Reservation Lock, access from other clients is blocked according to the lock type.
    • Details on mandatory locking for NFSv4 are available in How is Mandatory Locking supported for NFSv4 on ONTAP 9.
  • fcntl on UNIX/Linux uses POSIX advisory byte-range (record) locking. 
    • On NFSv4.x, the kernel maps fcntl locks to NFSv4 LOCK operations.
    • NFSv4 Share Reservation Lock is different from fcntl locks; it is part of the OPEN operation and controls file open modes (share_access and share_deny).
    • POSIX does not expose share deny semantics via fcntl.
    • Most UNIX/Linux NFSv4 clients use share_deny-none by default.
  • For Windows clients, LockFileEx is used for advisory locking over CIFS/SMB. 

Lock enforcement depends on application and protocol behavior.

  • NFSv3 does not support mandatory locking.
  • NFSv4.x supports mandatory locking via Share Reservation Lock, but POSIX APIs (fcntl) do not provide a way to request share deny semantics

Additional Information

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