Locking propigation probelm samba to netatalk & netatalk to samba

Mike Fedyk mfedyk at matchmail.com
Wed Oct 18 18:35:26 GMT 2000

Mike Brodbelt wrote:
> As I understand it, Samba 2.0.7 implements oplocks for windows clients,
> but those locks do not propagate to the underlying Unix system. This can
> cause locking problems with Unix apps and windows apps accessing the
> same files, which is essentially what you are seeing. Neither Netatalk
> or Samba have any idea that the file is locked by the other.
> One of the new features of Samba 2.2 is the mapping of oplocks to POSIX
> locks. From the release notes:-

I have disabled oplocks, and kernel oplocks.  Oplocks aren't the problem, and
they work perfectly, even level 2 oplocks in a smb only setup.

> ========================================================
> Rewritten internal locking semantics for more robustness.
> This alpha supports full 64 bit locking semantics on all
> (even 32 bit) platforms. SMB locks are mapped onto POSIX
> locks (32 bit or 64 bit) as the underlying system allows.
> ========================================================
> This should mean that, assuming your undelying system supports POSIX
> locks, then Samba will have done its bit with regard to this. You still
> need Netatalk to honour the POSIX locks, and also to map Mac locks to
> POSIX locks to be able to use this sort of setup with impunity. I have
> no idea what the state of this sort of thing is within Netatalk - maybe
> someone on the Netatalk list will know this...

It looks like older versions of netatalk used flock, but newer versions may be
using fcntl.  This makes me think that the underlying unix will see the lock.

I've also read that samba needs fcntl locks to work properly.  Why don't they
see each other's locks if both are using fcntl?

> I'd suggest that you make Mac and Windows users use different shares for
> write access. Allow both groups read-only access to the others shares,
> and if they need to edit a file, they can make a copy. Otherwise, you're
> probably in for large amounts of pain....

This would be a major pain because we have two departments that are slowly
replacing macs with  NT and they need to work on the same sets of files with
working locks.  

If this can't happen, I'll look into smb from the mac, and as a last resort,
I've tested this under NT and the locking works between smb and afp, although
it'll be slower, that's better than data corruption.  That would be bad, because
I'm trying to move all of our file serving from mac (completed) and NT over to

> Mike.


Mike Fedyk                   "They that can give up essential liberty
Information Systems           to obtain a little temporary safety
Match Mail Productions Inc.   deserve neither liberty nor safety."
mfedyk at matchmail.com                                   Ben Franklin

More information about the samba mailing list