[Samba] File locking problem

Iain iain at mein.it
Mon Apr 24 11:40:02 GMT 2006


I've a situation where file locking does not seem to functioning. I have
the following entries in my smb.conf file:

*** /etc/samba/smb.conf ***
linux # testparm -v | grep lock
Load smb config files from /etc/samba/smb.conf

<snip>

Warning: Service printers defines a print command, but print command
parameter is ignored when using CUPS libraries.
Server role: ROLE_DOMAIN_PDC
Press enter to see a dump of your service definitions

        kernel oplocks = Yes
        lock spin count = 3
        lock spin time = 10
        oplock break wait time = 0
        lock directory = /var/cache/samba
        block size = 1024
        veto oplock files =
        blocking locks = Yes
        fake oplocks = No
        locking = Yes
        oplocks = Yes
        level2 oplocks = Yes
        oplock contention limit = 2
        posix locking = Yes
        strict locking = Yes
*** END ***

If user A has a file open and user B then opens the same file, user B
can save the file without seeing a single warning about the file being
opened by another user.

The following is debug output from user B session whilst user A has the
same file (my_test_file.txt) open:

*** debug session ***
[2006/04/24 13:29:30, 2] lib/access.c:check_access(324)
  Allowed connection from  (192.168.9.157)
[2006/04/24 13:29:30, 2] lib/access.c:check_access(324)
  Allowed connection from  (192.168.9.157)
[2006/04/24 13:29:30, 2] smbd/open.c:open_file(369)
  conrad opened file tmp/my_test_file.txt read=Yes write=No (numopen=1)
[2006/04/24 13:29:30, 2] smbd/open.c:open_file(369)
  conrad opened file tmp/my_test_file.txt read=No write=No (numopen=2)
[2006/04/24 13:29:30, 2] smbd/close.c:close_normal_file(308)
  conrad closed file tmp/my_test_file.txt (numopen=1)
[2006/04/24 13:29:30, 2] smbd/close.c:close_normal_file(308)
  conrad closed file tmp/my_test_file.txt (numopen=0)
[2006/04/24 13:29:30, 2] lib/access.c:check_access(324)
  Allowed connection from  (192.168.9.157)
[2006/04/24 13:29:41, 2] smbd/open.c:open_file(369)
  conrad opened file tmp/my_test_file.txt read=Yes write=Yes (numopen=1)
[2006/04/24 13:29:42, 2] smbd/close.c:close_normal_file(308)
  conrad closed file tmp/my_test_file.txt (numopen=0)
[2006/04/24 13:29:45, 2] smbd/open.c:open_file(369)
  conrad opened file tmp/my_test_file.txt read=Yes write=No (numopen=1)
[2006/04/24 13:29:45, 2] smbd/close.c:close_normal_file(308)
  conrad closed file tmp/my_test_file.txt (numopen=0)
*** END ***

Have I missed a setting somewhere?

Thanks.

Iain.



More information about the samba mailing list