Using oplocks

What oplocks do

Oplocks (opportunistic locks) enable the redirector on a CIFS client in certain file-sharing scenarios to perform client-side caching of read-ahead, write-behind, and lock information. A client can then work with a file (read or write it) without regularly reminding the server that it needs access to the file in question. This improves performance by reducing network traffic.

When to use oplocks

Under some circumstances, if a process has an exclusive oplock on a file and a second process attempts to open the file, the first process must relinquish the oplock and access to the file. The redirector must then invalidate cached data and flush writes and locks, resulting in possible loss of data that was to be written.

Data loss possibilities

Any application that has write-cached data can lose that data under the following set of circumstances:

Error handling and write completion

The cache itself does not have any error handling--the applications do. When the application makes a write to cache, the write is always completed. If the cache, in turn, makes a write to the target system over a network, it must assume that the write is completed because if it does not, the data is lost.

When to turn oplocks Off

CIFS oplocks on the filer are On by default.

You might turn CIFS oplocks Off under either of the following circumstances:

Otherwise, you can leave CIFS oplocks On.

Turning oplocks On and Off globally

You can turn CIFS oplocks On or Off globally for the entire filer or for individual qtrees, which are special directories that are described in detail in Chapter 12, "Qtree administration."

Turning oplocks Off

You turn all CIFS oplocks Off with the following options command:

options cifs.oplocks.enable off
Turning oplocks On

You turn CIFS oplocks On with the following options command:

options cifs.oplocks.enable on

Turning oplocks On or Off at individual clients

You can turn CIFS oplocks On or Off at individual clients. Turning CIFS oplocks On at the filer does not override any client-specific settings. Turning CIFS oplocks Off at the filer disables all oplocks to or from the filer.

For additional information

For additional information about oplocks, consult the Microsoft Knowledge Base at http://www.microsoft.com/kb.


Copyright © 1999, Network Appliance, Inc. All rights reserved.

Part No. 210-02334
File: cifs25.htm
Last updated: 02/24/99 12:16:32