[Samba] File locking problem involving Samba, Clearcase, and Cygwin

Rob Shinn rob.shinn at gmail.com
Fri Feb 6 21:23:42 GMT 2009

On Fri, Feb 6, 2009 at 1:23 PM, Kathy <banshee135 at gmail.com> wrote:

> # first statement is old and may not be obsolete but we still keep it
> just in case
> oplocks = no
> kernel oplocks = no
> level2 oplocks = no

If you have 'oplocks = no', then it doesn't matter what 'kernel oplocks' or
'level2 oplocks' are set to.  Samba will ignore them.

However, as shown below, we're seeing oplocks reported and I have no
> idea whether this is normal or not.  I asked a Clearcase support guy
> and he did not know (sigh).  So hence I'm hoping someone here has some
> experience with this.  Again, we ran this same sort of set up before
> with a Solaris Clearcase/Samba server and we didn't see these
> problems.  This may not be related to Clearcase at all and simply and
> issue of how file locking is working between RHEL 5.2 and Samba.  What
> exactly is a LEVEL_II oplock and why am I seeing these if I have Samba
> oplocks turned off?

level2 oplocks from smb.conf manpage:

Level2, or read-only oplocks allow Windows NT clients that have an oplock on
a file to downgrade from a read-write oplock to a read-only oplock once a
second client opens the file (instead of releasing all oplocks on a second
open, as in traditional, exclusive oplocks). This allows all openers of the
file that support level2 oplocks to cache the file for read-ahead only (ie.
they may not cache writes or lock requests) and increases performance for
many accesses of files that are not commonly written (such as application
.EXE files).

if oplocks = no, then the 'level2 oplocks; doesn't do anything.

Note that oplocks parameter should be set per share.  Please post the output
of your 'testparm' command.

More information about the samba mailing list