Interesting, yet stupid test case

Mark Johnston markj at freebsd.org
Mon Aug 19 18:53:49 UTC 2013


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);
 }


More information about the freebsd-scsi mailing list