Subject: Re: NetBSD, apple fibre-channel card & 2.8TB Xserve-RAID
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Charles M. Hannum <>
List: tech-kern
Date: 12/06/2004 04:16:16
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

You didn't say whether you're using a FFS v1 or v2 file system, and I don't 
recall whether you specified the block and fragment sizes, but I did a very 
quick audit of the FFS code and found what looks like a serious truncation 
problem.  Attached is a diff that I think will fix it.

(The problem is the usage of fsbtodb(nb) in getblk() calls.  It needs to be 
expanded to 64 bits somewhere, and fsbtodb() doesn't do it.)

Content-Type: text/x-diff;
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;

Index: ffs_balloc.c
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_balloc.c,v
retrieving revision 1.36
diff -u -r1.36 ffs_balloc.c
--- ffs_balloc.c	14 Aug 2004 01:30:56 -0000	1.36
+++ ffs_balloc.c	6 Dec 2004 04:11:09 -0000
@@ -103,13 +103,12 @@
 	int size;
 	struct ucred *cred;
 	int flags;
-	int32_t nb;
 	struct buf *bp, *nbp;
 	struct vnode *vp = ap->a_vp;
 	struct inode *ip = VTOI(vp);
 	struct fs *fs = ip->i_fs;
 	struct indir indirs[NIADDR + 2];
-	daddr_t newb, pref;
+	daddr_t newb, pref, nb;
 	int32_t *bap;	/* XXX ondisk32 */
 	int deallocated, osize, nsize, num, i, error;
 	int32_t *blkp, *allocblk, allociblk[NIADDR + 1];