[Samba] Samba client file locking

Matthias Reif matthreif at gmail.com
Thu May 25 06:56:08 GMT 2006


Thanks for your reply.

> I noticed that depending on the client I use Samba creates a different
> kind
> > of lock with different behaviour when multiple clients attempt to open
> the
> > same file. Neither smbfs nor cifs create the correct lock share mode
> > (DENY_WRITE) and the access mode is different (smbfs:0x3, cifs:0x12019f
> as
> > opposed to Windows: 0x2019f)
> You're confusing deny modes with locks. They are not the same thing.
> Are you talking about locks or deny modes here ?

Yes sorry, I guess I am a bit confused about the difference between the two.
According to my Samba book - "Share (deny) modes are used by clients to gain
exclusive read or write access to a file", which sounds very similar to the
idea of a lock and seems the right mechanism to achieve my desired result.
What I don't understand is why the SMBFS and CIFS kernel modules create a
deny mode DENY_NONE instead of DENY_WRITE when the client opens the file for
read/write access. Shouldn't it always be DENY_WRITE if the client issues a
open(..., O_RDWR)?
Is it the deny mode or the hexadecimal access mode (as shown by smbstatus)
that Samba uses to report back to the client that the file is currently
locked for writing?


More information about the samba mailing list