Friday, November 13, 2015

[FreeNAS Disable "Opportunistic Locking".]: Disable "Opportunistic Locking".

Disable "Opportunistic Locking".


smbd[xxx]: read_data: read failure for 4 bytes to client XXX.XXX.XXX.XXX Error = Connection reset by peer

Did you see this error message in your log's?


What Operating Systems are Affected?

All server computers running Windows operating systems in the NT family, Windows NT, Windows 2000, Windows XP and Windows 2003 Server.

All workstation computers running Windows operating systems in the 9X family , this includes Windows 98 and Windows ME.

Link : 
Solutions:

1. Server side(FreeNAS )
The safe way will be the server side(FreeNAS), however not confirmed for the moment.
On WebGUI : Services: CIFS /SMB : Settings > “Auxiliary parameters” you can add:
Dave suggested on this thread https://sourceforge.net/forum/message.php?msg_id=4849132  , that setting only  oplocks = no fix the problem for him (clients Win XP and 2003).

level2 oplocks = no 
kernel oplocks = no

Note:
  • Changing the configuration on the server side will affect all clients connected to that specific server(CIFS/SMB only).
  • No restart required.
  • Safer that editing window registry.

2. Client side(Windows only).

Important This article contains information about how to modify the registry. Make sure that you back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry see: http://support.microsoft.com/kb/256986/

Disabling Read Caching on Windows Workstations (All Windows operating systems in the 9X family) 

The Windows registry entry that controls read caching on Windows network clients is:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\VREDIR
DiscardCacheOnOpen REG_BINARY 0 or 1
Default: 0 (not disabled)
To disable read caching, the value of DiscardCacheOnOpen must be set to 1.

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

Please read the Microsoft disclaimer regarding editing of the Windows registry here.

STEPS:

1. Start > Run > Regedit.exe
2. Click on the + (plus sign) next to HKey_Local_Machine
3. Click on the + (plus sign) next to System
4. Click on the + (plus sign) next to CurrentControlSet
5. Click on the + (plus sign) next to Services
6. Click on the + (plus sign) next to VxD
7. Click on the VREDIR entry on the left-hand side of Registry Editor

8. If the DiscardCacheOnOpen registry value already exists (on the right-hand side of Registry Editor), ensure that its value is 1

9. If the DiscardCacheOnOpen value already exists but its value is not 1, double-click on DiscardCacheOnOpen to change its value to 1

10. If the DiscardCacheOnOpen entry does not exist, right-click in the white space of the right-hand side of Registry Editor
11. Select New > Binary value
12. Rename the value to DiscardCacheOnOpen
13. Double-click on DiscardCacheOnOpen to change its value to 1

Disabling Opportunistic Locking on Windows Servers ( Windows NT, Windows 2000, Windows XP and Windows 2003 Server).

There are 2 Windows registry entries that control opportunistic locking (oplocks) on Windows network servers:

1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters EnableOpLockForceClose
2. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters EnableOplocks

1. EnableOpLockForceClose

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
EnableOpLockForceClose REG_DWORD 0 or 1
Default: 0 (not disabled)

To disable oplocks, the value of EnableOpLockForceClose must be set to 1.

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

Please read the Microsoft disclaimer regarding editing of the Windows registry here.

STEPS:

1. Start > Run > Regedit.exe
2. Click on the + (plus sign) next to HKey_Local_Machine
3. Click on the + (plus sign) next to System
4. Click on the + (plus sign) next to CurrentControlSet
5. Click on the + (plus sign) next to Services
6. Click on the + (plus sign) next to LanManServer
7. Click on the Parameters entry on the left-hand side of Registry Editor

8. If the EnableOpLockForceClose registry value already exists (on the right-hand side of Registry Editor), ensure that its value is 1

9. If the EnableOpLockForceClose value already exists but its value is not 1, double-click on EnableOpLockForceClose to change its value to 1

10. If the EnableOpLockForceClose entry does not exist, right-click in the white space of the right-hand side of Registry Editor
11. Select New > DWORD value
12. Rename the value to EnableOpLockForceClose
13. Double-click on EnableOpLockForceClose to change its value to 1

No comments: