+++ This bug was initially created as a clone of Bug #172194 +++ Using smbfs on a 2.6.9-11.EL kernel, with the server being a Win2k, Win2k3, Win9x, NT4 or Samba3, when listing a directory with a large number of files, and some long names, some files end up missing in the listing. From the comments in RHEL4's linux-2.6.9/fs/smbfs/request.c: /* * max parameters + max data + max setup == bufsize to make NT4 happy * and not abort the transfer or split into multiple responses. It also * makes smbfs happy as handling packets larger than the buffer size * is extra work. * * OS/2 is probably going to hate me for this ... */ So: max data = bufsize - max parameters - max setup which means: mdata = req->rq_bufsize - SMB_TRANS2_MAX_PARAM - server->opt.max_xmit - 100; /* the -100 being to make OS/2 happy, apparently */ The current code doesn't do that... -- Additional comment from bnocera on 2005-11-01 09:22 EST -- Created an attachment (id=120601) linux-2.6.9-smbfs-wrong-packet-size.patch The problem also exists on RHEL3, where both the code and the comments are broken. Patch from Jose Plans <jplans>
Created attachment 120602 [details] rhel3-smbfs-mdata.patch
Created attachment 121584 [details] linux-2.4.21-smbfs-wrong-packet-size.patch With correct spacing
We had negative feedback on this patch. I'm currently testing it again.
Created attachment 121677 [details] test-smbfs.pl Test case. Creates loads of files with long names.
I modified the script to create 900 files (instead of 7000) of 35 characters filename lengths. On a local filesystem: $ mkdir test $ cd test $ ../test-smbfs.pl 35 $ ls -1 | wc -l 900 $ uname -r 2.4.21-37.8.EL $ sudo mount -t smbfs -o username=Administrator,password=redhat //win2k/smbfs /mnt/smb/ $ cd /mnt/smb $ sudo ~/test-smbfs.pl 35 $ ls -1 | wc -l 1019 [and more of those] $ ls -1 | sort | uniq | wc -l 900 It appears that some files are duplicated in the listing.
$ mkdir smbfs $ cd smbfs $ cp -a /usr/src/linux-`uname -r`/fs/smbfs/* . $ cp -a ~/Makefile . $ wget "https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=121584" $ patch < attachment.cgi\?id\=121584 patching file sock.c $ make $ sudo /sbin/rmmod smbfs rmmod: module smbfs is not loaded $ sudo insmod ./smbfs.o $ sudo mount -t smbfs -o username=Administrator,password=redhat //win2k/smbfs /mnt/smb/ $ cd /mnt/smb/ $ sudo ~/test-smbfs.pl 35 $ ls -1 | wc -l 796 $ ls -1 | wc -l 796 $ ls -1 | wc -l 900 [And 900 from then on]
Created attachment 121683 [details] Makefile Makefile used to compile smbfs out-of-tree
The kernel tested was a 2.4.21-37.8.EL on an em64t machine.
The Windows machine was a stock Windows 2000 Server.