svn commit: r255741 - stable/8/sys/dev/mfi

Mark Johnston markj at FreeBSD.org
Fri Sep 20 21:52:33 UTC 2013


Author: markj
Date: Fri Sep 20 21:52:33 2013
New Revision: 255741
URL: http://svnweb.freebsd.org/changeset/base/255741

Log:
  MFC r254742:
  Hold mfi_io_lock across calls to xpt_rescan() and xpt_alloc_ccb_nowait().
  xpt_rescan() expects the SIM lock to be held, and we trip a mtx_assert if
  the driver initiates multiple rescans in quick succession.

Modified:
  stable/8/sys/dev/mfi/mfi_cam.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/mfi/   (props changed)

Modified: stable/8/sys/dev/mfi/mfi_cam.c
==============================================================================
--- stable/8/sys/dev/mfi/mfi_cam.c	Fri Sep 20 21:51:38 2013	(r255740)
+++ stable/8/sys/dev/mfi/mfi_cam.c	Fri Sep 20 21:52:33 2013	(r255741)
@@ -321,17 +321,16 @@ mfip_cam_rescan(struct mfi_softc *sc, ui
 		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;
 	}
 
 	sim = camsc->sim;
-	mtx_lock(&sc->mfi_io_lock);
 	if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sim),
 	    tid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
 		xpt_free_ccb(ccb);
@@ -340,11 +339,8 @@ mfip_cam_rescan(struct mfi_softc *sc, ui
 		    "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 svn-src-stable-8 mailing list