Thursday, August 18, 2011

Opportunistic Locking in samba

Samba support Dos and windows standard locking concept as a most primitive locks also known as Deny mode locks. Although we can switch off this lock using 'share modes = no' parameter is smb.conf .
Samba also support a locking mechanism known as Opportunistic Locking or oplocks in short. Oplocks allow a client to notify samba server that it will not only be exclusive writer of file, but also will cache its changes so that network files get speed up access. Oplocks improve performance . Suppose machine A is editing a file and machine B try to access at same time, in this case samba send oplock break to client A and client A stop caching and update with current state.
We can disable oplocks using following parameter in smb.conf
oplocks = no
We can also exclude some extensions files from oplock using
veto oplocks file = /*.idd/*.doc