Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2013 22:55:52 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254742 - head/sys/dev/mfi
Message-ID:  <201308232255.r7NMtq84046459@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Fri Aug 23 22:55:52 2013
New Revision: 254742
URL: http://svnweb.freebsd.org/changeset/base/254742

Log:
  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.
  
  Reported by:	sbruno
  Tested by:	sbruno
  MFC after:	1 week

Modified:
  head/sys/dev/mfi/mfi_cam.c

Modified: head/sys/dev/mfi/mfi_cam.c
==============================================================================
--- head/sys/dev/mfi/mfi_cam.c	Fri Aug 23 22:52:20 2013	(r254741)
+++ head/sys/dev/mfi/mfi_cam.c	Fri Aug 23 22:55:52 2013	(r254742)
@@ -308,17 +308,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);
@@ -327,11 +326,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);
 }



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