Bug 172196 - Missing files when listing an NT4 share
Summary: Missing files when listing an NT4 share
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel
Version: 3.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Peter Staubach
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks: 170417 186960
TreeView+ depends on / blocked
 
Reported: 2005-11-01 14:25 UTC by Bastien Nocera
Modified: 2018-10-19 20:52 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-04-06 18:45:07 UTC
Target Upstream Version:
Embargoed:


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

Description Bastien Nocera 2005-11-01 14:25:52 UTC
+++ 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>

Comment 1 Bastien Nocera 2005-11-01 14:25:53 UTC
Created attachment 120602 [details]
rhel3-smbfs-mdata.patch

Comment 10 Bastien Nocera 2005-11-29 15:12:32 UTC
Created attachment 121584 [details]
linux-2.4.21-smbfs-wrong-packet-size.patch

With correct spacing

Comment 12 Bastien Nocera 2005-12-01 11:53:20 UTC
We had negative feedback on this patch. I'm currently testing it again.

Comment 13 Bastien Nocera 2005-12-01 11:55:49 UTC
Created attachment 121677 [details]
test-smbfs.pl

Test case. Creates loads of files with long names.

Comment 14 Bastien Nocera 2005-12-01 13:29:20 UTC
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 13:49:13 UTC
$ 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 13:50:19 UTC
Created attachment 121683 [details]
Makefile

Makefile used to compile smbfs out-of-tree

Comment 17 Bastien Nocera 2005-12-01 13:54:54 UTC
The kernel tested was a 2.4.21-37.8.EL on an em64t machine.

Comment 18 Bastien Nocera 2005-12-01 13:59:02 UTC
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.