[Clug-tech] Good Article on Samba Oplocks

Jon me at jonwatson.ca
Fri Apr 20 14:10:22 PDT 2007


Greetings,

We've been having intermittent problems with Simply Accounting and 
multiple users when the database resides on a Samba share for a while 
now. It seems that we've finally solved them and since it seems to be 
such a common problem I thought that I would post our (hopeful) solution 
here.

The problem surrounds a/my misunderstanding of oplocks. By name alone, 
oplocks sound to me like file locks and therefore sound like a desirable 
thing to have in a shared file environment. But oplocks really stands 
for 'oportunistic locking" and isn't really a lock at it. Oplocks are 
almost directly equivalent to 'client caching'.

Knowing that, it seems obvious that oplocks are not desirable in some 
situations and paramount amongst those are situations involving shared 
databases and PST files.

"oplocks should always be disabled if you are sharing a database file 
(e.g., Microsoft Access) between multiple clients, because any break the 
first client receives will affect synchronization of the entire file 
(not just the single record), which will result in a noticeable 
performance impairment and, more likely, problems accessing the database 
in the first place. Notably, Microsoft Outlook's personal folders 
(*.pst) react quite badly to oplocks." (link below).

By default, oplocks are turned on in recent versions of Samba, so in 
situations where they are not desirable they have to be specifically 
shut off by share or globally in the smb.conf file.

The main symptom we have seen over the months are 'network disconnect' 
errors when closing Simply Accounting or attempting to write to the 
database.

So far, turning off oplocks on the share(s) that contain the Simply 
databases seems to be working.

As usual there is more to it than this. Those looking for more info can 
read the Samba oplocks control section of this doc which is where I got 
most of my information:

http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/locking.html#id348952

Jon

-- 
Key fingerprint: BDE0 DE52 B8C0 0CDF 7653 E5A2 D861 7877 0D3B 813E
http://www.jonwatson.ca

"Trying to learn to hack on a DOS or Windows machine or under MacOS is
like trying to learn to dance while wearing a body cast" - ESR



More information about the clug-tech mailing list