[Samba] A samba locking question

Andrew Bartlett abartlet at samba.org
Wed Feb 4 11:04:56 GMT 2004


On Wed, 2004-02-04 at 21:14, Patrik Gustavsson wrote:
> Let me be more specific of what I am trying to do.

Finally... :-)

> I am the engineer at Sun that wrote the cluster agent for
> Samba, a standard HA agent.
> This works as a dream and is deployed on several clusters
> around the world.
> 
> Now, I am doing study to see if the standard samba can be run
> as a scalable service (Several smbd's on different nodes accessing
> the same data).
> I know the issue with oplocks, so they are disable duering this
> tests.
>
> The Sun Cluster has the feature GFS (Global File system) as
> what True Cluster has.
> And the GFS will propagate all fcntl(), lockf() calls to all the
> nodes in the cluster.
> 
> This has been tested by issuing a fcntl() locks on file, both local and
> remote, and having pc trying open that file and it's fail because it is
> locked.
> 
> The issue I have with Samba locks is that, when a client open
> file I can have put a fcntl() write lock on that file.
>
> That shouldn't be possible if the file or part of that file
> had been looked with a fcntl() call.

fcntl() locks are advisory.  I'll leave it to others to comment on how
Samba interacts with various combinations of locking, opens (which may
not request a lock) etc.   However, samba 3.0 ships with 'strict locking
= yes' as a default to better cover this case.

> The output from smbstatus for that file:
> 6696   DENY_WRITE 0x2019f     RDWR       NONE
> /global/mnt1/datadir/TEST.sxw   Wed Feb  4 10:50:44 2004
> 
> The samba version I am using is 3.0.1

So maintain correct CIFS semantics, you must push the full CIFS locks
into the GFS filesystem.  While this is possible to do, you need to be
very careful to do it *right*.  One demonstration hack is to host the
locking tdbs on the GFS filesystem.

You will find that your biggest issue is locking performance - this has
always been the problem with distributed CIFS.  

http://junkcode.samba.org/#ping_pong

Andrew Bartlett

-- 
Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20040204/02141688/attachment-0001.bin


More information about the samba-technical mailing list