What are locks, OpLocks and delayed breaks in ONTAP?
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:
- Client1 opens
\\storage_system\share\file1
requesting a batch or exclusive oplock - Storage system responds with a batch or exclusive oplock for file1 to Client1
- Client2 attempts to open
\\storage_system\share\file1
requesting a batch or exclusive oplock - 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.
- Client1 responds to the Oplock Break Request, flushing/committing its cached writes
- 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:
- Prior to Data ONTAP 9.0 Log, an Oplock Delayed Break message that includes the IP Address of the offending client to the syslog
- Forcefully cleans up any locks associated on the file for Client1
- Grants the open response to Client2