Quantcast
Channel: Serbian Tech » samba
Viewing all articles
Browse latest Browse all 3

Disable SAMBA oplocks in mixed environment

$
0
0

If you have a SAMBA server serving CIFS requests in a mixed environment
I suggest you disable the oplocks right away. Oplocks don’t work well with NFS, and also Netatalk.
Tho they give up to 30% performance gain in optimal conditions.

So what are Oplocks ?
Opportunistic locking (oplocks) is invoked by the Windows file system (as opposed to an API) via
registry entries (on the server and the client) for the purpose of enhancing network performance
when accessing a file residing on a server. Performance is enhanced by caching the file
locally on the client that allows the following:

Read-ahead:
The client reads the local copy of the file, eliminating network latency.

Write caching:
The client writes to the local copy of the file, eliminating network latency.

Lock caching:
The client caches application locks locally, eliminating network latency.

More information about Oplocks here , and here.

 
So the magic, to disable it globally use :

[global]
oplocks = False

You can also disable level 2 oplocks (which can only be disabled/enabled if oplocks are enabled globally)

[share]
level2 oplocks = False

Here comes the best part. You can also disable oplocks for specific files,
directories and or regular expressions. :)
Say you have a sharename called “Stuff” and you would like to disable oplocks on
certain .txt file, all files with www and a Microsoft Access Database Files (*.mdb).

[stuff]
veto oplock files = path/file*.txt
veto oplock files = www
veto oplock files = *.mdb

p.s. To change oplocks in Mac OS X Lion (10.7) just disable/enable them globally in /var/db/smb.conf
or disable it on share-basis in /var/db/samba/smb.shares


Viewing all articles
Browse latest Browse all 3

Trending Articles