DragonFly BSD
DragonFly commits List (threaded) for 2006-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/sys/bus/cam/scsi scsi_cd.c scsi_ch.c scsi_da.c scsi_pass.c scsi_pt.c scsi_sa.c scsi_ses.c src/sys/bus/firewire firewirereg.h fwdev.c fwmem.c src/sys/contrib/dev/fla fla.c src/sys/dev/disk/ata ata-disk.c ata-disk.h ata-raid.c ata-raid.h ...


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 7 Mar 2006 10:32:12 -0800 (PST)

:Apparently this commit broke ccd(4).  Strangely, vn_strategy() in ccdstart()
:calls acd_start() and ends up in a page fault trap.
:The kernel and vmcore images are on my leaf account as kernel.1 and
:vmcore.1, respectively, under ~y0neatn1/crash/.
:The kernel is built from the source as of 2006.02.17.20.00.00.
:
:Regards.

    CCD is doing some nasty things with struct buf's.  Try this (untested)
    patch.

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>

Index: ccd.c
===================================================================
RCS file: /cvs/src/sys/dev/disk/ccd/ccd.c,v
retrieving revision 1.22
diff -u -r1.22 ccd.c
--- ccd.c	17 Feb 2006 19:17:55 -0000	1.22
+++ ccd.c	7 Mar 2006 18:28:06 -0000
@@ -231,7 +231,7 @@
 
 static __inline
 struct ccdbuf *
-getccdbuf(struct ccdbuf *cpy)
+getccdbuf(void)
 {
 	struct ccdbuf *cbp;
 
@@ -243,19 +243,11 @@
 		--numccdfreebufs;
 		reinitbufbio(&cbp->cb_buf);
 	} else {
-		cbp = malloc(sizeof(struct ccdbuf), M_DEVBUF, M_WAITOK);
+		cbp = malloc(sizeof(struct ccdbuf), M_DEVBUF, M_WAITOK|M_ZERO);
 		initbufbio(&cbp->cb_buf);
 	}
 
 	/*
-	 * Used by mirroring code
-	 */
-	if (cpy)
-		bcopy(cpy, cbp, sizeof(struct ccdbuf));
-	else
-		bzero(cbp, sizeof(struct ccdbuf));
-
-	/*
 	 * independant struct buf initialization
 	 */
 	LIST_INIT(&cbp->cb_buf.b_dep);
@@ -1035,9 +1027,8 @@
 	/*
 	 * Fill in the component buf structure.
 	 */
-	cbp = getccdbuf(NULL);
+	cbp = getccdbuf();
 	cbp->cb_buf.b_flags = bio->bio_buf->b_flags;
-	/*cbp->cb_buf.b_dev = ci->ci_dev; */
 	cbp->cb_buf.b_data = addr;
 	cbp->cb_buf.b_vp = ci->ci_vp;
 	if (cs->sc_ileave == 0)
@@ -1074,9 +1065,28 @@
 	 */
 	if (cs->sc_cflags & CCDF_MIRROR) {
 		/* mirror, setup second I/O */
-		cbp = getccdbuf(cb[0]);
-		/* cbp->cb_buf.b_dev = ci2->ci_dev; */
+		cbp = getccdbuf();
+
+		cbp->cb_buf.b_flags = bio->bio_buf->b_flags;
+		cbp->cb_buf.b_data = addr;
 		cbp->cb_buf.b_vp = ci2->ci_vp;
+		if (cs->sc_ileave == 0)
+		      cbc = dbtob((off_t)(ci->ci_size - cbn));
+		else
+		      cbc = dbtob((off_t)(cs->sc_ileave - cboff));
+		cbp->cb_buf.b_bcount = (cbc < bcount) ? cbc : bcount;
+		cbp->cb_buf.b_bufsize = cbp->cb_buf.b_bcount;
+
+		cbp->cb_buf.b_bio1.bio_done = ccdiodone;
+		cbp->cb_buf.b_bio1.bio_caller_info1.ptr = cbp;
+		cbp->cb_buf.b_bio1.bio_blkno = cbn + cboff + CCD_OFFSET;
+		cbp->cb_buf.b_bio1.bio_offset = dbtob(cbn + cboff + CCD_OFFSET);
+
+		/*
+		 * context for ccdiodone
+		 */
+		cbp->cb_obio = bio;
+		cbp->cb_unit = cs - ccd_softc;
 		cbp->cb_comp = ci2 - cs->sc_cinfo;
 		cb[1] = cbp;
 		/* link together the ccdbuf's and clear "mirror done" flag */



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]