[Samba] Re: How Samba let us down

Steve Langasek vorlon at netexpress.net
Thu Oct 24 15:46:05 GMT 2002

On Thu, Oct 24, 2002 at 01:08:10PM +1000, Matthew Hannigan wrote:
> On Thu, Oct 24, 2002 at 02:10:14AM +0000, jra at dp.samba.org wrote:
> > On Wed, Oct 23, 2002 at 09:02:03PM -0500, Steve Langasek wrote:
> > > On Thu, Oct 24, 2002 at 11:38:55AM +1000, Matthew Hannigan wrote:
> > > 
> > > > I have read in the docs that Samba locks and Unix locks
> > > > _DO_ notice each other, with the caveats that Unix lock
> > > > daemons are sometimes buggy and that Unix locks can only
> > > > lock the first 2^31 bytes of a file.
> > > 
> > > > Please tell me that they do in fact notice each other.
> > > 
> > > Oplocks are not part of the traditional lock semantics available on
> > > Unix.  If you aren't running a kernel (Irix or Linux) that implements

> And Solaris?  At least they're autoconfigured to assume kernel oplocks
> according to testparm, and the docs say this is done only if the support
> is there.


       kernel oplocks (G)


              This parameter defaults to on, but is translated to
              a no-op on systems that no not have  the  necessary
              kernel  support.   You  should  never need to touch
              this parameter.

> > > oplocks, you MUST NOT use oplocks if the files will be accessed by
> > > applications other than Samba.

> > Don't confure the two. Oplocks are nothing to do with share
> > modes or byte range locks. They're just unfortunately named.

> I'll try not to confuse the two :-)

> So 'oplocks' and real locks are or are not noticed by other unix processes?

Real locks are always implemented using the available Unix facilities
for such, so any Unix app that implements locking properly will see the
Samba locks.  Note the hedging here: there are many different historical
locking mechanisms available on Unix, some of which are invisible to one
another; witness the myriad methods available for locking password files
and mail spools.  So if you have a Unix app that's doing locking
*badly*, it can cause problems for Samba connections just as it can
cause problems for any other Unix app.

OTOH, oplocks (which are not actually "locks" at all; more like "motion
detectors") were first implemented on Unix within Samba itself.  Given
the obvious advantages of having smooth interaction between Samba and
other Unix apps when using oplocks, efforts soon began to push oplocks
into the kernel -- first with Irix, later Linux, and ISTR that one or
more of the BSD kernels had someone working on implementing oplock

> I did have a look at the docs really, but textdocs/UNIX-SMB.txt
> for instance says that "Unix has no simple way of implementing
> opportunistic locking, and currently Samba has no support for it."

Heh... Whoops. :)

> Replies of the form "read the source Luke!" are ok; at least
> I'll know to stop searching elswhere.

I don't know anywhere better than the source, but maybe it's covered in
one of the many good Samba books currently available?

FWIW, everything I know about Samba locking came from the
samba-technical mailing list, but reading the archive in its entirety 
may not serve you better than reading the source. ;)

Steve Langasek
postmodern programmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba/attachments/20021024/9c5b39bf/attachment.bin

More information about the samba mailing list