Dragan Krnic
2008-Feb-04 18:08 UTC
[Samba] WinXP/x64 - MFC CFile objects leak parent directory handles
Samba 3.0.28-0.1.95-1624-SUSE-SL10.3 A strange problem (best read in a proportional font). It only happens on an x64 XP client when accessing a Samba share. The exact same program runs fine on the same x64 XP client when the share accessed is on a Windows server or when it is run on a 32-bit XP client, regardless of whether the share belongs to a Samba server or to a Windows server. I have traced the problem to a local instantiation of an object of MFC class CFile in the line 170 of the following code: 166 CString CWaitForChangedFile::GetFileContent() 167 { if (mstrFilePath.IsEmpty()) 168 return ""; 169 _my_TRY 170 CFile file(mstrFilePath, CFile::modeRead | CFile::shareDenyNone); 171 int size = (int)file.GetLength(); 172 CString text; 173 file.Close(); 174 text.Format("%d", size); 175 return text; 176 _my_REPORT_EXCEPTION_ALL 177 return "ERROR!!!!!"; 178 } When the programm using this method is run on a Windows XP Professional x64 Edition and a file "mstrFilePath" is opened for read with an oplock of type "DenyNone" on a Samba share, as above in line 170, a new handle to the parent directory remains stuck until the program is stopped, which should actually be removed when the program exits the method. The handle looks something like this in the output of "handle.exe -a -p thisProg.exe": 46C: File (RWD) \Device\LanmanRedirector\;X:0000000000014c30\samba\T01\ On the Linux side (SuSE 10.3, kernel 2.6.22.13-0.3-default) I can trace this behaviour to the fact that the transactions in the lines 39 through 60 in the following formatted audit log don't appear when the programm is run on an x64 XP, which DO get executed when the program is run on a 32-bit XP (the lines following the "getxattr" of "user.DOSATTRIB" after setting the "kernel_flock" on the already opened file). 1 stat T01/T01.ini 2 getxattr T01/T01.ini:user.DOSATTRIB 3 THE PREVIOUS 2 LINES REPEATED 14 TIMES 4 stat . 5 stat T01 6 getxattr No data T01|user.DOSATTRIB 7 stat T01/T01.ini 8 opendir T01 9 stat T01/T01.ini 10 stat T01/T01.ini 11 sys_acl_get_file T01/T01.ini 12 getxattr No data T01/T01.ini:user.SAMBA_PAI 13 sys_acl_get_entry 14 sys_acl_get_tag_type 15 sys_acl_get_permset 16 sys_acl_get_perm 17 sys_acl_get_perm 18 sys_acl_get_entry 19 sys_acl_get_tag_type 20 sys_acl_get_permset 21 sys_acl_get_perm 22 sys_acl_get_perm 23 sys_acl_get_entry 24 sys_acl_get_tag_type 25 sys_acl_get_permset 26 sys_acl_get_perm 27 sys_acl_get_perm 28 sys_acl_get_entry 29 sys_acl_free_acl 30 fget_nt_acl T01/T01.ini 31 getxattr T01/T01.ini:user.DOSATTRIB 32 closedir 33 stat T01/T01.ini 34 stat T01 35 getxattr T01/T01.ini:user.DOSATTRIB 36 open r T01/T01.ini 37 kernel_flock T01/T01.ini 38 getxattr T01/T01.ini:user.DOSATTRIB 39 *************** stat T01/T01.ini 40 sys_acl_get_file T01/T01.ini 41 getxattr No data T01/T01.ini:user.SAMBA_PAI 42 sys_acl_get_entry 43 sys_acl_get_tag_type 44 sys_acl_get_permset 45 sys_acl_get_perm 46 sys_acl_get_perm 47 sys_acl_get_entry 48 sys_acl_get_tag_type 49 sys_acl_get_permset 50 sys_acl_get_perm 51 sys_acl_get_perm 52 sys_acl_get_entry 53 sys_acl_get_tag_type 54 sys_acl_get_permset 55 sys_acl_get_perm 56 sys_acl_get_perm 57 sys_acl_get_entry 58 sys_acl_free_acl 59 get_nt_acl T01/T01.ini 60 ************** fstat T01/T01.ini 61 getxattr T01/T01.ini:user.DOSATTRIB 62 fstat T01/T01.ini 63 sendfile T01/T01.ini I guess that Samba sends the same information in response to a "getxattr" no matter what the bitness of the client is. So it's probably the client SMB code on x64 XP which is doing something in a different way when it finds out that the share belongs to a Samba server. No combination of oplock settings makes any difference. Does anyone know how to avoid this problem? Should I provide some more diagnostics?
Volker Lendecke
2008-Feb-04 18:50 UTC
[Samba] WinXP/x64 - MFC CFile objects leak parent directory handles
On Mon, Feb 04, 2008 at 07:07:36PM +0100, Dragan Krnic wrote:> Does anyone know how to avoid this problem? > Should I provide some more diagnostics?Your smb.conf, debug level 10 logs and sniffs of all combinations please! Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20080204/2545115c/attachment.bin
Volker Lendecke
2008-Feb-05 19:09 UTC
[Samba] WinXP/x64 - MFC CFile objects leak parent directory handles
On Tue, Feb 05, 2008 at 06:25:03PM +0100, Dragan Krnic wrote:> 1. messages.x64.fmt.bz2 formatted full_audit log > 2. pmn33.x64.bz2 formatted level 10 samba log > 3. wireshark.out.bz2 formatted wireShark print-out > 4. x64-26-07.bz2 capture file with relevant 200 packetsThis is not usable, sorry. Remove the formatting and send sniffs *COMPARING* both behaviours. Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20080205/bef7a57f/attachment.bin
Dragan Krnic
2008-Feb-27 07:11 UTC
[Samba] WinXP/x64 - MFC CFile objects leak parent directory handles
On 2/4/08, Volker Lendecke <Volker.Lendecke@sernet.de> wrote:> > On Mon, Feb 04, 2008 at 07:07:36PM +0100, Dragan Krnic wrote: > > Does anyone know how to avoid this problem? > > Should I provide some more diagnostics? > > Your smb.conf, debug level 10 logs and sniffs of all > combinations please! > > Volkermy effective smb.conf: 1 2 [global] 3 workgroup = PMN1 4 netbios name = PMN93 5 server string = "" 6 wins server = 172.24.204.184 7 preferred master = no 8 local master = no 9 domain master = no 10 server signing = no 11 encrypt passwords = yes 12 security = domain 13 time server = no 14 passwd program = /usr/bin/passwd %u 15 username level = 3 16 unix password sync = yes 17 lanman auth = no 18 dos filemode = yes 19 log level = 1 20 debug timestamp = yes 21 log file = /var/log/samba/%m 22 max log size = 65536 23 socket options = SO_KEEPALIVE IPTOS_LOWDELAY TCP_NODELAY 24 max xmit = 65535 25 unix charset = UTF8 26 display charset = UTF8 27 os level = 31 28 lock dir = /var/lock/samba/locks 29 pid directory = /var/lock/samba 30 create mask = 0664 31 directory mask = 0775 32 hide dot files = no 33 map system = no 34 map hidden = no 35 map archive = no 36 store dos attributes = yes 37 map acl inherit = yes 38 host msdfs = no 39 printing = cups 40 printcap name = cups 41 42 [homes] 43 comment = Home Directories 44 valid users = %U 45 read only = no 46 inherit permissions = yes 47 security mask = 0777 48 directory security mask = 0777 49 browseable = no 50 store dos attributes = yes 51 52 [PRIMA] 53 comment = "for Project work" 54 directory security mask = 0777 55 dos filetimes = yes 56 inherit permissions = yes 57 map system = no 58 oplocks = no 59 path = /local/PRIMA 60 read only = no 61 security mask = 0777 62 hide unreadable = yes 63 map hidden = no 64 map archive = no 65 store dos attributes = yes 66 map acl inherit = yes 67 use sendfile = yes 68 strict sync = yes I have enclosed 4 files compressed with bzip2 documenting the problem when an x64 client opens a file in a Samba share: 1. messages.x64.fmt.bz2 formatted full_audit log 2. pmn33.x64.bz2 formatted level 10 samba log 3. wireshark.out.bz2 formatted wireShark print-out 4. x64-26-07.bz2 capture file with relevant 200 packets All files include data captured at 16:26:07 today. The transaction opening the file for read, setting kernel_flock and returning xattr should start at about packet 69 in capture file.
Volker Lendecke
2008-Mar-07 19:21 UTC
[Samba] WinXP/x64 - MFC CFile objects leak parent directory handles
On Fri, Mar 07, 2008 at 05:02:00PM +0100, Dragan Krnic wrote:> Volker, can you please look at it and see if you can suggest a fix?Looking at it. Volker -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20080307/591b74c5/attachment.bin
Volker Lendecke
2008-Mar-07 21:05 UTC
[Samba] WinXP/x64 - MFC CFile objects leak parent directory handles
Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/samba/attachments/20080307/80c40bb5/attachment.bin