Bug 172196 - Missing files when listing an NT4 share
Missing files when listing an NT4 share
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Staubach
Brian Brock
:
Depends On:
Blocks: 170417 186960
  Show dependency treegraph
 
Reported: 2005-11-01 09:25 EST by Bastien Nocera
Modified: 2010-10-21 23:37 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-04-06 14:45:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
rhel3-smbfs-mdata.patch (1017 bytes, patch)
2005-11-01 09:25 EST, Bastien Nocera
no flags Details | Diff
linux-2.4.21-smbfs-wrong-packet-size.patch (728 bytes, patch)
2005-11-29 10:12 EST, Bastien Nocera
no flags Details | Diff
test-smbfs.pl (571 bytes, text/plain)
2005-12-01 06:55 EST, Bastien Nocera
no flags Details
Makefile (1.34 KB, text/plain)
2005-12-01 08:50 EST, Bastien Nocera
no flags Details

  None (edit)
Description Bastien Nocera 2005-11-01 09:25:52 EST
+++ 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@redhat.com 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@redhat.com>
Comment 1 Bastien Nocera 2005-11-01 09:25:53 EST
Created attachment 120602 [details]
rhel3-smbfs-mdata.patch
Comment 10 Bastien Nocera 2005-11-29 10:12:32 EST
Created attachment 121584 [details]
linux-2.4.21-smbfs-wrong-packet-size.patch

With correct spacing
Comment 12 Bastien Nocera 2005-12-01 06:53:20 EST
We had negative feedback on this patch. I'm currently testing it again.
Comment 13 Bastien Nocera 2005-12-01 06:55:49 EST
Created attachment 121677 [details]
test-smbfs.pl

Test case. Creates loads of files with long names.
Comment 14 Bastien Nocera 2005-12-01 08:29:20 EST
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.
Comment 15 Bastien Nocera 2005-12-01 08:49:13 EST
$ 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]
Comment 16 Bastien Nocera 2005-12-01 08:50:19 EST
Created attachment 121683 [details]
Makefile

Makefile used to compile smbfs out-of-tree
Comment 17 Bastien Nocera 2005-12-01 08:54:54 EST
The kernel tested was a 2.4.21-37.8.EL on an em64t machine.
Comment 18 Bastien Nocera 2005-12-01 08:59:02 EST
The Windows machine was a stock Windows 2000 Server.

Note You need to log in before you can comment on or make changes to this bug.