Notes for Disabling Opportunistic Locking ON Win2000 and Win XP

Windows NT and Windows 2000 ENABLE Opportunistic Locking (Oplock) on both the Server service and Workstation service by default. If a file is opened in a non-exlusive mode (deny none), with Exclusive Oplock, the redirector requests an oplock on the entire file. If no other process has the file open, the server will grant the oplock, giving the redirector exclusive access to the file, which allows read-ahead, write-behind, and lock caching. When another process opens the file, the original owner is asked to Break Oplock or Break to Level II Oplock. The redirector must invalidate cached data, flush all writes and locks, and release the oplock (or close the file). Opportunistic Locking level II is a method for granting read access to a file by more than one workstation. These workstations can read-ahead (cache locally), as long as no station writes to the file. When any workstation sends a write request, the server returns the write response and then asks all workstation that have the file open to Break to None, releasing any oplock. Since these workstations have no cached writes or locks, they simply invalidate their cache, without the need to respond to the Break to None.

To manage Opportunistic Locking, you SHOULD configure both the Workstation and/or Server service, using Regedt32.

NOTE: Windows 2000 does not add this entry to the registry by default. By default, it does not exist, and you must add it by editing the registry or by using a program that edits it. This is why you may not see an entry for Oplocks on certain stations and/or the Server in their registry. An excellent document on File Caching and Oplocks can be obtained at:

WORKSTATION: There are 3 settings for the local workstation for Opportunistic Locking that must be set in the Registry. If they are NOT in the registry settings, Opportunistic Locking is actually ENABLED (ON) by default. All 3 must be set or you will get errors. For example, in OEWIN, Error 4102 or Error 1342 after posting an Invoice or Order. DIC Errors after Day End can result and have been reported as well. The Options are under HKEY_LOCAL_MACHINE System\CurrentControlSet\Services\LanmanServer\Parameters for EnableOplocks. Set Value to 0. System\CurrentControlSet\Services\LanmanWorkstation\Parameters for UseOpportunisticLocking. Set Value to 0 System\CurrentControlSet\Services\MRxSmb\Parameters for OplocksDisabled. Set Value to 1 Edit or Add Value name EXACTLY as described above, as a REG_DWORD data type. A value of 1 is true. A data value of 0 is false.

SERVER: To configure the Server service, navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters

Value Name Default Range Description
Enable OpLocks 1(true) 0 or 1 A value of 0 will deny all clients the ability to use oplocks on this connection.
 MinLinkThroughput
 0  0 - x'ffffffff' bytes per second.  The minimum throughput before the server disables raw and opportunistic locks for this connection
 MaxLinkDelay
 60
0 - 100,000 seconds If delays exceed this number, the server disables raw I/O and opportunistic locks for this connection. Raw I/O is an optimizing feature that permits the Server service to send unsegmented data across the network. Because raw I/O can cause delays, the service disables it in an attempt to resolve the delay.
 OplockBreakWait
35 10-180 Seconds  The time that the server waits for clients to respond to an oplock break request.

This information has been provided by Softrak Systems, Inc.

Last Modified: July 14, 2010