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.
Got a bit more information on this one. In the output below, neteng02 has the file open. neteng-vm3 then opens the same file, receiving no warnings about the file being open by another user. File is modified by neteng02 and saved and remains open. File then modified by neteng-vm3 and saved. File closed and opened by neteng02 who sees modifications made by neteng-vm3. *** START *** log.neteng-vm3:[2006/04/26 11:33:57, 3] smbd/oplock_linux.c:linux_set_kernel_oplock(166) log.neteng-vm3: linux_set_kernel_oplock: got kernel oplock on file tmp/my_test_file.txt, dev = 804, inode = 251750772, file_id = 225 log.neteng-vm3:[2006/04/26 11:33:57, 5] smbd/oplock.c:set_file_oplock(125) log.neteng-vm3: set_file_oplock: granted oplock on file tmp/my_test_file.txt, dev = 804, inode = 251750772, file_id = 225, tv_sec = 444f3e85, tv_usec = 88676 log.neteng-vm3:[2006/04/26 11:33:57, 3] smbd/oplock.c:initial_break_processing(311) log.neteng-vm3: Current oplocks_open (exclusive = 0, levelII = 1) log.neteng02:[2006/04/26 11:33:57, 3] smbd/oplock.c:initial_break_processing(311) log.neteng02: Current oplocks_open (exclusive = 1, levelII = 0) log.neteng02:[2006/04/26 11:33:53, 3] smbd/oplock_linux.c:linux_set_kernel_oplock(166) log.neteng02: linux_set_kernel_oplock: got kernel oplock on file tmp/my_test_file.txt, dev = 804, inode = 251750772, file_id = 458 log.neteng02:[2006/04/26 11:33:53, 5] smbd/oplock.c:set_file_oplock(125) log.neteng02: set_file_oplock: granted oplock on file tmp/my_test_file.txt, dev = 804, inode = 251750772, file_id = 458, tv_sec = 444f3e81, tv_usec = d7ef7 *** END *** Why are the file locks not being respected here? TIA. Iain.