kern/130330: [mpt] [panic] Panic and reboot machine MPT ...

John Baldwin jhb at freebsd.org
Wed May 20 14:21:32 UTC 2009


On Tuesday 12 May 2009 12:10:25 pm Riccardo Torrini wrote:
> On Tue, May 12, 2009 at 11:44:20AM -0400, John Baldwin wrote:
> 
> > If you can get a stack trace, that would be most helpful.
> > My guess is that the recovery thread is holding the mpt lock
> > and calling some CAM routine which attempts to relock it via
> > cam_periph_lock().  A stack trace would be most telling in
> > that case.
> 
> Rebooted, inserted 2nd disk (copied by hand, sorry for delay)

Try this.  It reverts the single-CCB part of the previous commit while keeping 
the other fixes.  I missed that the CCB might still be in flight when we 
schedule another rescan.

Index: mpt_raid.c
===================================================================
--- mpt_raid.c	(revision 192376)
+++ mpt_raid.c	(working copy)
@@ -658,19 +658,19 @@
 static void
 mpt_cam_rescan_callback(struct cam_periph *periph, union ccb *ccb)
 {
+
 	xpt_free_path(ccb->ccb_h.path);
+	xpt_free_ccb(ccb);
 }
 
 static void
 mpt_raid_thread(void *arg)
 {
 	struct mpt_softc *mpt;
-	union ccb *ccb;
 	int firstrun;
 
 	mpt = (struct mpt_softc *)arg;
 	firstrun = 1;
-	ccb = xpt_alloc_ccb();
 	MPT_LOCK(mpt);
 	while (mpt->shutdwn_raid == 0) {
 
@@ -698,15 +698,21 @@
 		}
 
 		if (mpt->raid_rescan != 0) {
+			union ccb *ccb;
 			struct cam_path *path;
 			int error;
 
 			mpt->raid_rescan = 0;
+			MPT_UNLOCK(mpt);
 
+			ccb = xpt_alloc_ccb();
+
+			MPT_LOCK(mpt);
 			error = xpt_create_path(&path, xpt_periph,
 			    cam_sim_path(mpt->phydisk_sim),
 			    CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
 			if (error != CAM_REQ_CMP) {
+				xpt_free_ccb(ccb);
 				mpt_prt(mpt, "Unable to rescan RAID Bus!\n");
 			} else {
 				xpt_setup_ccb(&ccb->ccb_h, path, 5);
@@ -719,7 +725,6 @@
 			}
 		}
 	}
-	xpt_free_ccb(ccb);
 	mpt->raid_thread = NULL;
 	wakeup(&mpt->raid_thread);
 	MPT_UNLOCK(mpt);

-- 
John Baldwin


More information about the freebsd-stable mailing list