[Samba] rsync: readdir(.): Bad file descriptor (9)
Jim Carroll
jim at carroll.com
Mon Nov 7 22:22:13 GMT 2005
Hi,
I've spent the better part of three weeks tracking into this problem. I hope
you don't mind a post here on smbfs, but I was hoping someone might have
some insight or ideas on where to look next.
Summary: trying to rsync folders across an smb mounted share with EXACTLY 50
objects (folder or files), results in the error
rsync: readdir(.): Bad file descriptor (9)
Details
The problem seems to be related to the number of objects in a folder.
The problem can very easily be re-created by creating 50 files in a samba
share, and trying to rsync it to a FreeBSD 4.11 or Darwin box.
# mount_smbfs -I [ipaddr w2k] '//Administrator at w2k/C$' /mnt
# mkdir /mnt/dummy
# cd /mnt/dummy
# touch 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
# rsync -rn /mnt/dummy /var/tmp
Error message
building file list ... rsync: readdir(.): Bad file descriptor (9)
The source of the error message is /usr/src/sys/netsmb/smb_rq.c
Line 344
if (rqp->sr_vc->vc_hflags2 & SMB_FLAGS2_ERR_STATUS) {
error = md_get_uint32le(mdp, &rqp->sr_error);
} else {
error = md_get_uint8(mdp, &rqp->sr_errclass);
error = md_get_uint8(mdp, &tb);
error = md_get_uint16le(mdp, &rqp->sr_serror);
if (!error)
rperror = smb_maperror(rqp->sr_errclass, rqp->sr_serror);
I'm working through the netsmb source code, but it's slow going.
I ran the above example on
# uname -a
FreeBSD 30.dhcp.hck.carroll.com 4.11-STABLE FreeBSD 4.11-STABLE #1: Tue Nov
1 22:15:50 EST 2005
jim at 30.dhcp.hck.carroll.com:/usr/src/sys/compile/NC.DEBUG i386
We also ran it on a Darwin machine
$ uname -a
Darwin 94.dhcp.hck.carroll.com 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30
20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh
powerpc
Both machines reported the same error.
building file list ... rsync: readdir(.): Bad file descriptor (9)
What's particularly interesting, is other utilities can successfully recurse
into the directory without any problems. I've written a small command line
utility that does
opendir()
readdir()
lstat()
which is basically what rsync does, I get no errors. I've gone over rsync
with gdb, and can't find anything too unusual going on. Execpt for the fact
that I can only create the problem using rsync.
Any pointers, crazy ideas, off the wall theories, etc... would be greatly
appreciated.
---
Jim C. | Carroll-Net, Inc.
201-488-4092 |
www.carroll.com | Application Service Provider
More information about the samba
mailing list