svn commit: r255740 - stable/9/sys/dev/mfi

Mark Johnston markj at FreeBSD.org
Fri Sep 20 21:51:39 UTC 2013


Author: markj
Date: Fri Sep 20 21:51:38 2013
New Revision: 255740
URL: http://svnweb.freebsd.org/changeset/base/255740

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/9/sys/dev/mfi/mfi_cam.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/mfi/mfi_cam.c
==============================================================================
--- stable/9/sys/dev/mfi/mfi_cam.c	Fri Sep 20 21:26:51 2013	(r255739)
+++ stable/9/sys/dev/mfi/mfi_cam.c	Fri Sep 20 21:51:38 2013	(r255740)
@@ -307,17 +307,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, NULL, cam_sim_path(sim),
 	    tid, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
 		xpt_free_ccb(ccb);
@@ -326,11 +325,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-9 mailing list