Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 May 2009 10:21:23 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Riccardo Torrini <riccardo.torrini@esaote.com>
Cc:        Attilio Rao <attilio@FreeBSD.org>, scottl@freebsd.org, siedar@nplay.pl, freebsd-stable@freebsd.org
Subject:   Re: kern/130330: [mpt] [panic] Panic and reboot machine MPT ...
Message-ID:  <200905201021.23633.jhb@freebsd.org>
In-Reply-To: <20090512161025.GO21112@tiger.fi.esaote.it>
References:  <20090507155012.GW21112@tiger.fi.esaote.it> <200905121144.21406.jhb@freebsd.org> <20090512161025.GO21112@tiger.fi.esaote.it>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905201021.23633.jhb>