CIFS/9000 Server Opportunistic Locking Usage Recommendations Version 1.02 October, 2002 Eric Roseme SNSL Advanced Technology Center E0300 Printed in: U.S.A.
Legal Notices The information in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this manual, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Hewlett-Packard shall not be held liable for errors contained herein or direct, indirect, special, incidental or consequential damages in connection with the furnishing, performance, or use of this material. Warranty.
Contents Legal Notices ..................................................................................................................... 2 Chapter 1 Introduction ...................................................................................................... 4 Chapter 2 Opportunistic Locking Overview ....................................................................... 5 Chapter 3 CIFS/9000 Oplock Configuration .......................................................................
Chapter 1 Introduction CIFS/9000 Server on HP-UX manages file access among Windows clients with Windows style file locking. It applies a very effective set of file locking features that are managed by the user-space client processes on the server, and provides excellent data security and integrity in a multi-user environment.
Chapter 2 Opportunistic Locking Overview OPPORTUNISTIC LOCKING (Oplocks) is invoked by the Windows file system (as opposed to an API) via registry entries (on the server AND client) for the purpose of enhancing network performance when accessing a file residing on a server.
Client 1 3 reads writes local cache 2 cl 1 op ient en f cac ile he file l o 5 op call y lock b 6 flu rea k sh file to s erv er s CIFS/9000 Server har ed acc ess Client 2 [share] 7 oplocks = yes s cces a d e shar est requ n e p 4o 1. 2. 3. 4. 5. 6. 7. Client 1 opens file on CIFS/9000 Server share. Client has exclusive access to file (no other processes are accessing the file). Exclusive access is not an access mode (like DENY_ALL) – it is an access state. Client 1caches the file locally.
Chapter 3 CIFS/9000 Oplock Configuration OPPORTUNISTIC LOCKING (Oplocks) is implemented by the CIFS/9000 server on a per -share basis in the smb.conf file. CIFS/9000 Oplock functionality operates just like Windows. Oplocks are enabled by default for each share, which allows the Windows client to cache a local copy of a file for: Read-ahead Write-caching Lock caching CIFS/9000 disables Oplocks on a per -share basis in the smb.conf file: [share_name] oplocks = no The default is “yes”.
file caching without the risk of data corruption. Veto Oplocks can be enabled on a per -share basis, or globally for the entire server, in the smb.conf file: [global] veto oplock files = /filename.htm/*.txt/ [share_name] veto oplock files = /*.exe/filename.ext/ oplock break wait time is a smb.conf parameter that adjusts the time interval for Samba to reply to an oplock break request. Samba recommends “DO NOT CHANGE THIS PARAMETER UNLESS YOU HAVE READ AND UNDERSTOOD THE SAMBA OPLOCK CODE.
Chapter 4 Opportunistic Locking Recommendations Opportunistic locking is a desirable feature when it can enhance the perceived performance of a networked client. However, the opportunistic locking protocol is not robust, and therefore can encounter problems when invoked beyond a simplistic configuration, or on extended, slow, or faulty networks.
4.3 Unix or NFS Client Accessed Files Local HP-UX (Unix) and NFS clients access files without a mandatory file locking mechanism (see the whitepaper “CIFS/9000 File Locking Interoperation” at http://snslweb.cup.hp.com/getfile.php?id=58). Thus, these client platforms are incapable of initiating an oplock break request from the server to a Windows client that has a file cached.
where the network is slow or unreliable, an oplock break can become lost without the user even accessing a file. This can cause apparent performance degradation as the client continually reconnects to overcome the lost oplock break. So avoid the following combination: • • • 4.8 “force user” in smb.
Chapter 5 Summary Windows Opportunistic Locking is a lightweight performance-enhancing feature. It is not a robust and reliable protocol. Every implementation of Opportunistic Locking should be evaluated as a tradeoff between perceived performance and reliability. Reliability decreases as each successive rule above is not enforced.