[Samba] Incomplete dir listing (ext2fs / FreeBSD)

Rainer Schwarze rsc at admadic.de
Wed Nov 7 14:56:11 GMT 2007


I moved a disk with ext2fs from a Linux box (SuSE) into my FreeBSD6.2
box. Some directories on that disk are shared to my Windows boxes via
v3.0.26a (according to smbd -V). A couple of directories contain a large
number of files (hundreds to thousands).

The list of files is incomplete using Windows clients or
smbclient on FreeBSD.
If I copy the directories to a disk using ufs, the
file listings on Windows / smbclient are complete.

With my last test I created files named "file-0150.file" down to
"file-0000.file" in a directory and fetched a directory listing from a
Windows client. I see files with number 0150 down to 0122.
With log level = 10 the following entries show up in the log files,
which I hope are the most relevant ones:

[2007/11/06 23:42:45, 5] smbd/trans2.c:get_lanman2_dir_entry(1255)
  get_lanman2_dir_entry found private
<pathtomyfiles>/tmp2/file-0022.file fname=file-0022.file

(this is the last file which I see in the directory listing)

[2007/11/06 23:42:45, 5] smbd/trans2.c:get_lanman2_dir_entry(1255)
  get_lanman2_dir_entry found <pathtomyfiles>/tmp2/file-0021.file

(this one is not shown in the list)

[2007/11/06 23:42:45, 9] smbd/trans2.c:get_lanman2_dir_entry(1635)
  get_lanman2_dir_entry: out of space

(to me looks like the entries found so far filled the buffer and should
be sent.)

[2007/11/06 23:42:45, 3] smbd/trans2.c:call_trans2findnext(2015)
  call_trans2findnext: dirhandle = 256, max_data_bytes = 16384,
maxentries = 1366, close_after_request=0, close_if_end = 2
= 4 resume_key = 0 resume name = file-0022.file continue=0 level = 260

(looks like the entries following the specified file shall be fetched.)

[2007/11/06 23:42:45, 3] smbd/trans2.c:call_trans2findnext(2115)
  dptr_num is 256, mask = *, attr = 16, dirptr=(0x83702C0,3140)
[2007/11/06 23:42:45, 8] smbd/trans2.c:call_trans2findnext(2120)
  dirpath=<<pathtomyfiles>/tmp2> dontdescend=<>
[2007/11/06 23:42:45, 10] smbd/mangle_hash2.c:is_mangled(276)
  is_mangled file-0022.file ?
[2007/11/06 23:42:45, 10] smbd/mangle_hash2.c:is_mangled_component(215)
  is_mangled_component file-0022.file (len 14) ?
[2007/11/06 23:42:45, 8] smbd/trans2.c:get_lanman2_dir_entry(1161)
  get_lanman2_dir_entry:readdir on dirptr 0x83702c0 now at offset -1

(The line above seems to be the point where the problem shows its symptoms.)

[2007/11/06 23:42:45, 5] smbd/trans2.c:call_trans2findnext(2200)
  call_trans2findnext: closing dptr_num = 256
[2007/11/06 23:42:45, 4] smbd/dir.c:dptr_close_internal(238)
  closing dptr key 256

I already decided that I'll switch to ufs.
However, I wonder whether it is worth investigating the problem. (I
would keep a little ext2fs place to have a test environment for that.)

Since the problem does not appear on ufs, it smells a bit like an ext2fs
problem just under FreeBSD. Especially since everything was ok when the
disk was in a Linux box.

What do you think about it?
In case its not primarily a problem in samba code, what lower level
problem could cause this behaviour in the samba code?

Thanks and best wishes, Rainer

More information about the samba mailing list