Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Aug 2013 14:54:26 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        sbruno@freebsd.org
Cc:        "FreeBSD-scsi@freebsd.org" <FreeBSD-scsi@freebsd.org>
Subject:   Re: Interesting, yet stupid test case
Message-ID:  <20130819185426.GA4765@charmander.sandvine.com>
In-Reply-To: <1376934295.1455.4.camel@localhost>
References:  <1376934295.1455.4.camel@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 19, 2013 at 10:44:54AM -0700, Sean Bruno wrote:
> Was able to get mfi to detonate (via CAM) today on stable/9 
> 
> At the loader prompt, physically remove some amount of drives (in my
> case drives 0-5, as 6-11 are my zroot).  Boot up into single user via
> boot -s
> 
> System will attempt to process all the events in the controller on boot
> up and die violently.  :-)

Yuck. :(

I think we're not supposed to drop the SIM lock before calling
xpt_rescan(); the other drivers I've looked at don't do this at least.
We're also unnecessarily dropping the mfi lock around the call to
xpt_alloc_ccb_nowait().

I think the following (untested) patch should help. I can try testing it
myself later if I can get a hold of some equipment at work (might take a
few days).

Thanks,
-Mark

Index: mfi_cam.c
===================================================================
--- mfi_cam.c	(revision 254539)
+++ mfi_cam.c	(working copy)
@@ -307,10 +307,10 @@
 		return;
 	}
 	camsc->state = MFIP_STATE_RESCAN;
-	mtx_unlock(&sc->mfi_io_lock);
 
 	ccb = xpt_alloc_ccb_nowait();
 	if (ccb == NULL) {
+		mtx_unlock(&sc->mfi_io_lock);
 		device_printf(sc->mfi_dev,
 		    "Cannot allocate ccb for bus rescan.\n");
 		return;
@@ -317,7 +317,6 @@
 	}
 
 	sim = camsc->sim;
-	mtx_lock(&sc->mfi_io_lock);
 	if (xpt_create_path(&ccb->ccb_h.path, NULL, cam_sim_path(sim),
 	    tid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
 		xpt_free_ccb(ccb);
@@ -326,11 +325,8 @@
 		    "Cannot create path for bus rescan.\n");
 		return;
 	}
-	mtx_unlock(&sc->mfi_io_lock);
-
 	xpt_rescan(ccb);
 
-	mtx_lock(&sc->mfi_io_lock);
 	camsc->state = MFIP_STATE_NONE;
 	mtx_unlock(&sc->mfi_io_lock);
 }



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