[Samba] File Locking

Rashkae rashkae at tigershaunt.com
Thu Feb 22 15:14:56 GMT 2007


On Thu, 2007-02-22 at 09:31 -0500, Alan Cheers wrote:
> Hi-
> 
> I'm running Samba on OpenSuse10.2 and have shared some drives with
> Windows clients.  The clients are accessing a bunch of MS Word files on
> the server and we have experienced a lot of weird file locking
> problems.
> 
> Sometimes MS Word will open the file as Read-Only which is creating a
> bit of a headache.  I would like to turn off file locking completely on
> the Samba side and was wondering what I needed to add to the .conf
> file.
> 
> Is this enough?
> 
> oplocks = No
> level2 oplocks = No
> 
> 
> Also, if I turn off the file locking on Samba and not on the clients
> via the registry, what kind of behaviour might I expect?
> 

No, oplocks are only a performance tweak, but turning them off will not
disable file locking.  As per the the smb.conf man file, (and though I
hesitate to even tell you this.) locking = no is what you are asking
for. However, I caution that a "Minor Headache" is nothing compared to
the trouble you are asking for with this approach. locking=no should
never be used on a filesystem that isn't read-only to begin with!  It
would be better, rather, to try to discover the source of your woe.
Maybe, when you find a workstation that refuses to open a file
read-write, you can try  to run smbstatus on the server to find which
computer is keeping a lock on that file.


> Thanks for any input.
> 
> -Alan


More information about the samba mailing list