[Samba] A samba locking question

Patrik Gustavsson Patrik.Gustavsson at Sun.COM
Thu Feb 5 08:25:25 GMT 2004

The things that tricked me was that I read the docs
for Samba 3 regarding locks.

And it says in the third paragraph in section 14.2

"Samba 2.2 and above implements record locking completely independent
of the underlying UNIX system. If a byte range lock that the client
requests happens to fall into the range of 0-2^31, Samba hands this
request down to the UNIX system. All other locks cannot be seen by
UNIX, anyway"

I interperted that Samba would do fcntl locks on the file if the request
is below 2^31 and not if it is above.
Which are not true.

Secondly, I don't understand why Samba is checking if a file
locked through fcntl before opening it, when it is not locking 
the file through fcntl when Samba is opening the file.


On ons, 2004-02-04 at 18:38, Jeremy Allison wrote:
> On Wed, Feb 04, 2004 at 11:14:31AM +0100, Patrik Gustavsson wrote:
> > 
> > Let me be more specific of what I am trying to do.
> > 
> > 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.
> > 
> > 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
> This won't work unless you have some method of propagating
> the open file table (found in locking.tdb) which tells clients
> what the current open share modes are.
> You need to solve this basic problem before you get to esoterica
> like byte range locks across the cluster.
> Jeremy.
"In a world without fences who needs Gates"
Patrik Gustavsson, Senior Technical Consultant
patrik.gustavsson at sun.com     Telephone: +46 60 671540
http://glen.sweden            Mobile: +46 70 3551040
SUN MICROSYSTEMS              Fax: +46 60 671550

More information about the samba mailing list