Skip to main content
NetApp Knowledge Base

What are locks, OpLocks and delayed breaks in ONTAP?

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

Applies to

  • ONTAP 9
  • CIFS / SMB
  • NFS

Answer

Normal Locks Stops other client machines from accessing file while an existing client is accessing it. Cannot be removed.
Oplocks Allows for sharing of read access of file and client side caching of locked information.
  • Oplocks, here called locks, are set by a client on write access and must be released to allow another client exclusive write access, and caches some, or all of the file to the client machine for editing.
  • Oplocks allow a client to cache data locally to increase performance and reduce network use. However, if a CIFS session is lost, any changes that have not been written to disk can be lost.
  • Oplocks can broken manually or based on rules defined in ONTAP

Example sequence:

  1. Client1 opens \\storage_system\share\file1 requesting a batch or exclusive oplock
  2. Storage system responds with a batch or exclusive oplock for file1 to Client1
  3. Client2 attempts to open  \\storage_system\share\file1 requesting a batch or exclusive oplock
  4. Storage system holds off on the open request to Client2 and sends an Oplock Break Request to Client1, requesting it to flush/commit its changes and release its locks.
  5. Client1 responds to the Oplock Break Request, flushing/committing its cached writes
  6. Storage system grants the open to Client2 with the appropriate lock

Note: In Step 4, if Client1 does not respond to the Oplock Break Request in 35 seconds, the storage system does three things:

  1. Prior to Data ONTAP 9.0 Log, an Oplock Delayed Break message that includes the IP Address of the offending client to the syslog
  2. Forcefully cleans up any locks associated on the file for Client1
  3. Grants the open response to Client2

 

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.