This article was previously published under Q129202
This article has been archived. It is offered "as is" and will no longer be updated.
With Exclusive Oplock, if a file is opened in a non-exclusive (deny none)mode, the redirector requests an opportunistic lock of the entire file. Aslong as no other process has the file open, the server will grant thisoplock, giving the redirector exclusive access to the specified file. Thiswill allow the redirector to perform read-ahead, write-behind, and lockcaching, as long as no other process tries to open the file.
When a second process attempts to open the file, the original owner willbe asked to Break Oplock or Break to Level II Oplock. At that point, theredirector must invalidate cached data, flush writes and locks, andrelease the oplock, or close the file.
Opportunistic Locking level II, provides a method for granting read accessto a file by more than one workstation, and these workstations can cacheread data locally (read-ahead). As long as no station writes to the file,multiple stations can have the file open with level II oplock.
An illustration of how level II oplocks work:
Station 1 opens the file, requesting oplock.
Since no other station has the file open, the server grants station 1 exclusive oplock.
Station 2 opens the file, requesting oplock.
Since station 1 has not yet written to the file, the server asks station 1 to Break to Level II Oplock.
Station 1 complies by flushing locally buffered lock information to the server.
Station 1 informs the server that it has Broken to Level II Oplock (alternatively, station 1 could have closed the file).
The server responds to station 2's open request, granting it level II oplock. Other stations can likewise open the file and obtain level II oplock.
Station 2 (or any station that has the file open) sends a write request SMB. The server returns the write response.
The server asks all stations that have the file open to Break to None, meaning no station holds any oplock on the file. Because the workstations can have no cached writes or locks at this point, they need not respond to the break-to-none advisory; all they need do is invalidate locally cashed read-ahead data.
The following registry entries are used to enable or disable oplocks forWindows NT Workstation or Server. These registry keys may not exist bydefault. To access the registry run REGEDT32.EXE from the File menu,choose Run in Program Manager or File Manager.
WARNING: Using Registry Editor incorrectly can cause serious, system-wideproblems that may require you to reinstall Windows NT to correct them.Microsoft cannot guarantee that any problems resulting from the use ofRegistry Editor can be solved. Use this tool at your own risk.
Workstation Service Entries
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet \Services\LanmanWorkstation\ParametersUseOpportunisticLocking REG_DWORD 0 or 1Default: 1 (true)
Indicates whether the redirector should use opportunistic-locking (oplock)performance enhancement. This parameter should be disabled only to isolateproblems.
Server Service Entries
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet \Services\LanmanServer\ParametersEnableOplocks REG_DWORD 0 or 1Default: 1 (true)
Specifies whether the server allows clients to use oplocks on files.Oplocks are a significant performance enhancement, but have the potentialto cause lost cached data on some networks, particularly wide-areanetworks.
MinLinkThroughput REG_DWORD 0 to infinite bytes per secondDefault: 0
Specifies the minimum link throughput allowed by the server before itdisables raw and opportunistic locks for this connection.
MaxLinkDelay REG_DWORD 0 to 100,000 secondsDefault: 60
Specifies the maximum time allowed for a link delay. If delays exceed thisnumber, the server disables raw I/O and opportunistic locking for thisconnection.
OplockBreakWait REG_DWORD 10 to 180 secondsDefault: 35
Specifies the time that the server waits for a client to respond to anoplock break request. Smaller values can allow detection of crashedclients more quickly but can potentially cause loss of cached data.
Microsoft Mail for PC Networks 3.0, Microsoft Mail for PC Networks 3.2, Microsoft Mail for PC Networks 3.2a, Microsoft Mail for PC Networks 3.5, Microsoft Windows NT Workstation 3.5, Microsoft Windows NT Workstation 3.51, Microsoft Windows NT Workstation 4.0 Developer Edition, Microsoft Windows NT Server 3.5, Microsoft Windows NT Server 3.51, Microsoft Windows NT Server 4.0 Standard Edition