File locking on SMB fs mounted on Linux and accessed directly

Grzegorz Prokopski prokopsk at novell.itn.pwr.wroc.pl
Tue Apr 18 19:54:29 GMT 2000


Hi all!

I've seen similar topics in the archive, but havent seen such
case as mine is. So I have to post it.

I'am trying to get dosemu file locking working on samba shares.
It doesnt work ;( for me.

When I run two or more dosemu's in one directory it locking
works (between them) - doesnt matter if it il "local" fs
or mounted via smb.
BUT if one of the sub fs are SMB mounts (I mean sth like
One program runs in /mnt/first, second in /mnt/second,
where /mnt/first is exported via SMB and mounted as
/mnt/second using smbclient. So file /mnt/first/test_file
is the same as /mnt/second/test_file - shouldn't it be ? ;)

I trace'd dosemu and it locks file this way (it's byte range
locking using fcntl)
fcntl(fd,F_SETL,&arg)
and arg looks like:
larg.l_type = 1 //LOCKING
larg.l_whence = 0
larg.l_start = 0
larg.l_len = 4

For unlock it changes: larg.l_type = 2 //UNLOCKING
It does this locking right way - i think.

But the locks "don't see each other" - every mounted share
lives it's own life - and causes data corruption.

Don't know what You need to help me.
Here's my smb.conf (part of)

[zakupy]
   comment = Resource ZAKUPY
   path = /mnt/zakupy
   public = yes
   read only = no
   create mode = 755
   force directory mode = 755
   force user = zakupy
   force group = users
   locking = yes
   opportunistic locking = no
   strict locking = yes
   oplocks = False
   blocking locks = False

Version (RH 6.0):
[root at mini /root]# rpm -qa |grep samba
samba-2.0.3-8

I've been trying lot's of other options sets but
none worked.

Final question is clear (I think):
What shoul'd I do to make byte-range file locks working
on samba shares ? And why doesn't it work ?
It looks realy strange too me (read almost all the doc's
that come with samba - there were tips how to solve
similar or such problems - none worked ;( )

At begining I wanted to make working dosemus on linux
and dos sessions on win98. Windows seen their lock's
(Yes - windows locks were seen by other windows !)
and dosemus (on one computer) seen their.

I would suspect it is something in linux smb client code
that makes it not working.

Please, Please - don't leave this mail alone.
I'am not a subscribed to The List so reply to my priva
addres mailto:prokopsk at novell.itn.pwr.wroc.pl
I CC'ed this message to myself to make it easier.

Many thanks in advance.
Waiting for any help.

				Grzegorz Prokopski


More information about the samba-technical mailing list