[Samba] Samba client file locking

Jeremy Allison jra at samba.org
Thu May 25 14:50:33 GMT 2006


On Thu, May 25, 2006 at 04:56:08PM +1000, Matthias Reif wrote:
> 
> 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)?

No. UNIX access knows nothing about DENY modes / SHARE modes.
UNIX access should *always* use DENY_NONE (which doesn't restrict
any other opens).

> 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?

Depends on the app. Some apps use deny mode, some use byte range
locks.

Jeremy.


More information about the samba mailing list