[Samba] linux_set_kernel_oplock: Refused oplock on file. F_SETLEASE semantic problem ?

Cedric Delfosse cedric.delfosse at linbox.com
Wed Jun 21 16:43:39 GMT 2006


Cedric Delfosse a écrit :
> Jeremy Allison a écrit :
>> On Thu, Jun 15, 2006 at 11:39:21AM +0200, Cedric Delfosse wrote:
>>> (Samba 3.0.21c / kernel 2.4.27 / Debian Sarge)
>>>
>>> Hello,
>>>
>>> One of my user open a file (located on a SAMBA server) in its 
>>> application, and when he tries to save it, he gets a "share 
>>> violation" error. (other people have this problem too).
>>> This error happens since I upgraded the SAMBA server from 3.0.14a to 
>>> 3.0.21c.
>>>
>>> smbstatus for this file:
>>>
>>> 32613        DENY_WRITE 0x20089     RDONLY     NONE 
>>> /home/user/J84400os-V8   Thu Jun 15 10:46:05 2006
>>>
>>> Samba log when trying to save the file:
>>>
>>> [2006/06/15 10:50:44, 2] smbd/open.c:open_file(350)
>>> user1 opened file J84400os-V8 read=Yes write=No (numopen=12)
>>> [2006/06/15 10:50:44, 3] 
>>> smbd/oplock_linux.c:linux_set_kernel_oplock(161)
>>> linux_set_kernel_oplock: Refused oplock on file J84400os-V8,
>>> fd = 33, dev = b, inode = 2621998. (Resource temporarily unavailable)
>>
>> You can turn off kernel oplocks with "kernel oplocks = no"
>> in your smb.conf. You might want to try 3.0.22 (or the 3.0.23RC2)
>> instead as we made changes in this area.
> 
> I will try 3.0.22 and tell you if this fix my problem.

Setting "kernel oplocks = No" didn't fix the problem too: I now get a 
"Access Denied" error. Here is now what I have into the samba log (the 
user opens the file and tries to save it):

This may be important: the "Services" directory of the filename you will 
see in the log is coming from a imported file system via autofs (NFS).

...
[2006/06/21 15:58:09, 3] smbd/process.c:process_smb(1194)
   Transaction 82990 of length 312
[2006/06/21 15:58:09, 3] smbd/process.c:switch_message(993)
   switch message SMBtrans2 (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:09, 3] smbd/trans2.c:call_trans2qfilepathinfo(2861)
   call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 1004
[2006/06/21 15:58:09, 3] smbd/trans2.c:call_trans2qfilepathinfo(2913)
   call_trans2qfilepathinfo 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans 
(fnum = -1) level=1004 call=5 total_data=0
[2006/06/21 15:58:09, 3] smbd/process.c:process_smb(1194)
   Transaction 82991 of length 322
[2006/06/21 15:58:09, 3] smbd/process.c:switch_message(993)
   switch message SMBtrans2 (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:09, 3] smbd/trans2.c:call_trans2findfirst(1632)
   call_trans2findfirst: dirtype = 16, maxentries = 1366, 
close_after_first=0, close_if_end = 2 requires_resume_key = 4 level = 
0x104, max_data_bytes = 16384
[2006/06/21 15:58:09, 3] smbd/dir.c:dptr_create(511)
   creating new dirptr 256 for path 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans, 
expect_close = 1
[2006/06/21 15:58:09, 3] smbd/process.c:process_smb(1194)
   Transaction 82992 of length 312
[2006/06/21 15:58:09, 3] smbd/process.c:switch_message(993)
   switch message SMBtrans2 (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:09, 3] smbd/trans2.c:call_trans2qfilepathinfo(2861)
   call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 1004
[2006/06/21 15:58:09, 3] smbd/trans2.c:call_trans2qfilepathinfo(2913)
   call_trans2qfilepathinfo 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans 
(fnum = -1) level=1004 call=5 total_data=0
[2006/06/21 15:58:09, 3] smbd/process.c:process_smb(1194)
   Transaction 82993 of length 360
[2006/06/21 15:58:09, 3] smbd/process.c:switch_message(993)
   switch message SMBtrans2 (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:09, 3] smbd/trans2.c:call_trans2findfirst(1632)
   call_trans2findfirst: dirtype = 16, maxentries = 1366, 
close_after_first=1, close_if_end = 2 requires_resume_key = 4 level = 
0x104, max_data_bytes = 16384
[2006/06/21 15:58:09, 3] smbd/dir.c:dptr_create(511)
   creating new dirptr 256 for path 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans, 
expect_close = 1
[2006/06/21 15:58:09, 3] smbd/process.c:process_smb(1194)
   Transaction 82994 of length 364
[2006/06/21 15:58:09, 3] smbd/process.c:switch_message(993)
   switch message SMBntcreateX (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:09, 3] smbd/dosmode.c:unix_mode(121) 
unix_mode(Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans/J16146os2-ind.C-MAP2) 
returning
0764
[2006/06/21 15:58:10, 2] smbd/open.c:open_file(350)
   tdebouche opened file 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans/J16146os2-ind.C-MAP2 
read=Yes write=No (numopen=4)
[2006/06/21 15:58:10, 3] smbd/process.c:process_smb(1194)
   Transaction 82995 of length 63
[2006/06/21 15:58:10, 3] smbd/process.c:switch_message(993)
   switch message SMBreadX (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:10, 3] smbd/reply.c:send_file_readX(2613)
   send_file_readX fnum=10241 max=4096 nread=4096
[2006/06/21 15:58:13, 3] smbd/process.c:process_smb(1194)
   Transaction 82996 of length 45
[2006/06/21 15:58:13, 3] smbd/process.c:switch_message(993)
   switch message SMBclose (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:13, 3] smbd/reply.c:reply_close(3271)
   close fd=29 fnum=10241 (numopen=4)
[2006/06/21 15:58:13, 3] smbd/sec_ctx.c:push_sec_ctx(256)
   push_sec_ctx(1043, 1000) : sec_ctx_stack_ndx = 1
[2006/06/21 15:58:13, 3] smbd/uid.c:push_conn_ctx(393)
   push_conn_ctx(103) : conn_ctx_stack_ndx = 0
[2006/06/21 15:58:13, 3] smbd/sec_ctx.c:set_sec_ctx(288)
   setting sec ctx (0, 0) - sec_ctx_stack_ndx = 1
[2006/06/21 15:58:13, 3] smbd/sec_ctx.c:pop_sec_ctx(386)
   pop_sec_ctx (1043, 1000) - sec_ctx_stack_ndx = 0
[2006/06/21 15:58:13, 2] smbd/close.c:close_normal_file(308)
   tdebouche closed file 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans/J16146os2-ind.C-MAP2 
(numopen=3)
[2006/06/21 15:58:13, 3] smbd/process.c:process_smb(1194)
   Transaction 82997 of length 354
[2006/06/21 15:58:13, 3] smbd/process.c:switch_message(993)
   switch message SMBtrans2 (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:13, 3] smbd/trans2.c:call_trans2qfilepathinfo(2861)
   call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 1004
[2006/06/21 15:58:13, 3] smbd/trans2.c:call_trans2qfilepathinfo(2913)
   call_trans2qfilepathinfo 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans/J16146os2-ind.C-MAP2 
(fnum = -1) level=1004 call=5 total_data=0
[2006/06/21 15:58:13, 3] smbd/process.c:process_smb(1194)
   Transaction 82998 of length 354
[2006/06/21 15:58:13, 3] smbd/process.c:switch_message(993)
   switch message SMBtrans2 (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:13, 3] smbd/trans2.c:call_trans2qfilepathinfo(2861)
   call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 1004
[2006/06/21 15:58:13, 3] smbd/trans2.c:call_trans2qfilepathinfo(2913)
   call_trans2qfilepathinfo 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans/J16146os2-ind.C-MAP2 
(fnum = -1) level=1004 call=5 total_data=0
[2006/06/21 15:58:13, 3] smbd/process.c:process_smb(1194)
   Transaction 82999 of length 354
[2006/06/21 15:58:13, 3] smbd/process.c:switch_message(993)
   switch message SMBtrans2 (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:13, 3] smbd/trans2.c:call_trans2qfilepathinfo(2861)
   call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 1004
[2006/06/21 15:58:13, 3] smbd/trans2.c:call_trans2qfilepathinfo(2913)
   call_trans2qfilepathinfo 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans/J16146os2-ind.C-MAP2 
(fnum = -1) level=1004 call=5 total_data=0
[2006/06/21 15:58:13, 3] smbd/process.c:process_smb(1194)
   Transaction 83000 of length 354
[2006/06/21 15:58:13, 3] smbd/process.c:switch_message(993)
   switch message SMBtrans2 (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:13, 3] smbd/trans2.c:call_trans2qfilepathinfo(2861)
   call_trans2qfilepathinfo: TRANSACT2_QPATHINFO: level = 1004
[2006/06/21 15:58:13, 3] smbd/trans2.c:call_trans2qfilepathinfo(2913)
   call_trans2qfilepathinfo 
Repertoires_Partages/EMTStvit/Services/Bureau_Etude/prive/Tell/plan/J/J16/J16146/J16146os/plans/outil-roulage/plans/J16146os2-ind.C-MAP2 
(fnum = -1) level=1004 call=5 total_data=0
[2006/06/21 15:58:13, 3] smbd/process.c:process_smb(1194)
   Transaction 83001 of length 74
[2006/06/21 15:58:13, 3] smbd/process.c:switch_message(993)
   switch message SMBtrans2 (pid 16301) conn 0x84a2e50
[2006/06/21 15:58:13, 3] smbd/trans2.c:call_trans2qfsinfo(2136)
   call_trans2qfsinfo: level = 259
[2006/06/21 15:58:13, 3] lib/sysquotas.c:sys_get_quota(401)
   sys_get_xfs_quota() failed for mntpath[/home] bdev[/dev/sda4] 
qtype[2] id[1043]: Function not implemented.
[2006/06/21 15:58:13, 3] lib/sysquotas.c:sys_get_quota(401)
   sys_get_xfs_quota() failed for mntpath[/home] bdev[/dev/sda4] 
qtype[4] id[1000]: Function not implemented.
[2006/06/21 15:58:50, 3] smbd/sec_ctx.c:set_sec_ctx(288)
   setting sec ctx (0, 0) - sec_ctx_stack_ndx = 0
[2006/06/21 15:58:52, 3] smbd/process.c:process_smb(1194)
   Transaction 83002 of length 312
........

The sys_get_xfs_quota() is weird, as the file is accessed via NFS. But 
the user home directory is /home, a mount XFS filesystem. Maybe there's 
a confusion somewhere. Here is the content of /etc/mtab:

/dev/sda3 / xfs rw 0 0
proc /proc proc rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs rw 0 0
/dev/sda1 /boot ext3 rw 0 0
/dev/sda4 /home xfs rw 0 0
usbfs /proc/bus/usb usbfs rw 0 0
automount(pid597) /net autofs rw,fd=4,pgrp=597,minproto=2,maxproto=4 0 0
fichier.emtstvit:/home /net/fichier.emtstvit/home nfs 
rw,nosuid,nodev,hard,intr,rsize=8192,wsize=8192,addr=192.168.3.1 0 0




Btw, I have found a way to reproduce the the kernel oplocks bug with 
SAMBA 3.0.21C and SAMBA 3.0.22. Looks like this is related to NFS. But I 
don't get the "share violation" error box from Windows.

Here is the howto:
  - On SAMBA server, in the home of a user, create a symbolic link to a 
NFS imported directory. For example, if "cedric" is my username, I have:

# ls /home/cedric -l
total 64
drwx--S---  2 cedric Domain Users   34 2006-06-16 14:44 Desktop
-rwx------  1 cedric Domain Users 6527 2006-06-21 18:14 Nouveau Texte 
Open Office.odt
lrwxrwxrwx  1 root   Domain Users   25 2006-06-21 17:05 tmp -> 
/net/soda/home/cedric/tmp

With /net/soda/home being mounted by autofs:

automount(pid1821) on /net type autofs 
(rw,fd=4,pgrp=1821,minproto=2,maxproto=4)
soda:/home on /net/soda/home type nfs 
(rw,nosuid,nodev,hard,intr,rsize=8192,wsize=8192,addr=192.168.0.6)

  - On Windows side (Win 2000), go to user share //SAMBA_IP/cedric, go 
in tmp, and create a new OpenOffice Document.
  - Write some stuff into the doc and save it.

The samba log will show when the file is opened:

[2006/06/21 18:14:09, 3] smbd/dosmode.c:unix_mode(121)
   unix_mode(Nouveau Texte Open Office.odt) returning 0700
[2006/06/21 18:14:09, 2] smbd/open.c:open_file(350)
   cedric opened file Open Office.odt read=Yes write=Yes (numopen=1)
[2006/06/21 18:14:09, 3] smbd/oplock_linux.c:linux_set_kernel_oplock(166)
   linux_set_kernel_oplock: got kernel oplock on file Open Office.odt, 
dev = 804, inode = 446, file_id = 27

And when writing the file:

[2006/06/21 18:14:27, 3] smbd/dosmode.c:unix_mode(121)
   unix_mode(Nouveau Texte Open Office.odt) returning 0700
[2006/06/21 18:14:27, 2] smbd/open.c:open_file(350)
   cedric opened file Nouveau Texte Open Office.odt read=Yes write=No 
(numopen=2)[2006/06/21 18:14:27, 3] 
smbd/oplock_linux.c:linux_set_kernel_oplock(161)
   linux_set_kernel_oplock: Refused oplock on file Nouveau Texte Open 
Office.odt, fd = 26, dev = 804, inode = 446. (Ressource temporairement 
non disponible)

But I don't get the "share violation" error message. So maybe this 
behaviour is normal.

-- 
Cédric Delfosse                             Linbox / Free&ALter Soft
152, rue de Grigy - Technopole Metz                       57070 METZ
tél : 03 87 50 87 98                               http://linbox.com


More information about the samba mailing list