13.4 MS Windows Opportunistic Locking and Caching Controls


13.4 MS Windows Opportunistic Locking and Caching Controls

There is a known issue when running applications (like Norton Anti-Virus) on a Windows 2000/XP workstation computer that can affect any application attempting to access shared database files across a network. This is a result of a default setting configured in the Windows 2000/XP operating system known as opportunistic locking . When a workstation attempts to access shared data files located on another Windows 2000/XP computer, the Windows 2000/XP operating system will attempt to increase performance by locking the files and caching information locally. When this occurs, the application is unable to properly function, which results in an " Access Denied " error message being displayed during network operations.

All Windows operating systems in the NT family that act as database servers for data files (meaning that data files are stored there and accessed by other Windows PCs) may need to have opportunistic locking disabled in order to minimize the risk of data file corruption. This includes Windows 9x/Me, Windows NT, Windows 200x, and Windows XP. [1]

[1] Microsoft has documented this in Knowledge Base article 300216.

If you are using a Windows NT family workstation in place of a server, you must also disable opportunistic locking (oplocks) on that workstation. For example, if you use a PC with the Windows NT Workstation operating system instead of Windows NT Server, and you have data files located on it that are accessed from other Windows PCs, you may need to disable oplocks on that system.

The major difference is the location in the Windows registry where the values for disabling oplocks are entered. Instead of the LanManServer location, the LanManWorkstation location may be used.

You can verify (change or add, if necessary) this registry value using the Windows Registry Editor. When you change this registry value, you will have to reboot the PC to ensure that the new setting goes into effect.

The location of the client registry entry for opportunistic locking has changed in Windows 2000 from the earlier location in Microsoft Windows NT.

N OTE

graphics/round_pencil.gif

Windows 2000 will still respect the EnableOplocks registry value used to disable oplocks in earlier versions of Windows.


You can also deny the granting of opportunistic locks by changing the following registry entries:

 
 HKEY_LOCAL_MACHINE\System\ CurrentControlSet\Services\MRXSmb\Parameters\ OplocksDisabled REG_WORD 0 or 1 Default: 0 (not disabled) 

N OTE

graphics/round_pencil.gif

The OplocksDisabled registry value configures Windows clients to either request or not request opportunistic locks on a remote file. To disable oplocks, the value of OplocksDisabled must be set to 1.


 
 HKEY_LOCAL_MACHINE\System\ CurrentControlSet\Services\LanmanServer\Parameters EnableOplocks REG_DWORD 0 or 1 Default: 1 (Enabled by Default) EnableOpLockForceClose REG_DWORD 0 or 1 Default: 0 (Disabled by Default) 

N OTE

graphics/round_pencil.gif

The EnableOplocks value configures Windows-based servers (including Workstations sharing files) to allow or deny opportunistic locks on local files.


To force closure of open oplocks on close or program exit, EnableOpLockForceClose must be set to 1.

An illustration of how Level2 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 Level2 oplock.

  • Station 1 complies by flushing locally buffered lock information to the server.

  • Station 1 informs the server that it has Broken to Level2 Oplock (alternately, station 1 could have closed the file).

  • The server responds to station 2's open request, granting it Level2 oplock. Other stations can likewise open the file and obtain Level2 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.

13.4.1 Workstation Service Entries

 
 \HKEY_LOCAL_MACHINE\System\ CurrentControlSet\Services\LanmanWorkstation\Parameters UseOpportunisticLocking REG_DWORD 0 or 1 Default: 1 (true) 

This indicates whether the redirector should use opportunistic-locking (oplock) performance enhancement. This parameter should be disabled only to isolate problems.

13.4.2 Server Service Entries

 
 \HKEY_LOCAL_MACHINE\System\ CurrentControlSet\Services\LanmanServer\Parameters EnableOplocks REG_DWORD 0 or 1 Default: 1 (true) 

This specifies whether the server allows clients to use oplocks on files. Oplocks are a significant performance enhancement, but have the potential to cause lost cached data on some networks, particularly wide area networks.

 
 MinLinkThroughput REG_DWORD 0 to infinite bytes per second Default: 0 

This specifies the minimum link throughput allowed by the server before it disables raw and opportunistic locks for this connection.

 
 MaxLinkDelay REG_DWORD 0 to 100,000 seconds Default: 60 

This specifies the maximum time allowed for a link delay. If delays exceed this number, the server disables raw I/O and opportunistic locking for this connection.

 
 OplockBreakWait REG_DWORD 10 to 180 seconds Default: 35 

This specifies the time that the server waits for a client to respond to an oplock break request. Smaller values can allow detection of crashed clients more quickly but can potentially cause loss of cached data.



Official Samba-3 HOWTO and Reference Guide
The Official Samba-3 HOWTO and Reference Guide, 2nd Edition
ISBN: 0131882228
EAN: 2147483647
Year: 2005
Pages: 297

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net