Subject: [Fwd: RE: rsync: readdir(.): Bad file descriptor (9)]
To: None <netbsd-users@NetBSD.org>
From: Nathan Arthur <truist@truist.com>
List: netbsd-users
Date: 08/28/2006 00:36:24
I'm using rsnapshot (from pkgsrc) to do rsync backups (to a netbsd 
machine) of files on a Windows XP box, mounted on the netbsd machine via 
smbfs.  When I first started doing this, I kept getting "Bad file 
descriptor" errors for certain directories, and eventually tracked down 
this: 
http://lists.samba.org/archive/samba-technical/2005-November/043823.html.  
I contacted the person who posted that message (as shown below) and they 
replied with a patch to smbfs_smb.c that fixes the problem, and a link 
to: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/78953 which 
describes the problem (and the fix) in detail. 

I've applied the patch to my machine and it fixes my problem.  My 
question is: how do I get this patch integrated into NetBSD? 

Thanks,

Nathan


-------- Original Message --------
Subject: 	RE: rsync: readdir(.): Bad file descriptor (9)
Date: 	Fri, 11 Aug 2006 09:25:57 -0400
From: 	Jim Carroll <jim@carroll.com>
Organization: 	Carroll-Net, Inc.
To: 	'Nathan Arthur' <truist@truist.com>



Hi Nathan,

Yes, I was able to finally trace the problem down and posted a path (plus
full description of the problem) to the FreeBSD PR system

http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/78953

Bottom line, apply this patch against smbfs_smb.c
 
 --- smbfs_smb.c	Wed Jan 28 01:21:01 2004
 +++ smbfs_smb.c.fix	Tue Nov 15 07:05:56 2005
 @@ -1224,8 +1224,10 @@ smbfs_smb_trans2find2(struct smbfs_fctx 
  		return error;
  	if ((error = md_get_uint16le(mdp, &tw)) != 0)
  		return error;
 -	if (ctx->f_ecnt == 0)
 +	if (ctx->f_ecnt == 0) {
 +		ctx->f_flags |= SMBFS_RDD_EOF | SMBFS_RDD_NOCLOSE;
  		return ENOENT;
 +		}
  	ctx->f_rnameofs = tw;
  	mdp = &t2p->t2_rdata;
  	if (mdp->md_top == NULL) {


I hope this helps.

---
Jim C.          | Carroll-Net, Inc.
201-488-4092    |
www.carroll.com | Application Service Provider
> -----Original Message-----
> From: Nathan Arthur [mailto:truist@truist.com]
> Sent: Friday, August 11, 2006 2:49 AM
> To: jim@carroll.com
> Subject: rsync: readdir(.): Bad file descriptor (9)
> 
> Jim,
> 
> I ran into the email thread archived at
> http://lists.samba.org/archive/samba-technical/2005-November/043823.html,
> and I seem to be having the same problem you described/debugged, on
> NetBSD 3.0.0.  (I'm not sure how to tell which version of smbfs I
> have.)  Did you ever find a good resolution to your problem?  Is there
> any chance that smbfs is being fixed?
> 
> Thanks,
> 
> Nathan