Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Apr 2013 13:18:34 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r248973 - head/sys/dev/tws
Message-ID:  <201304011318.r31DIYSt073777@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Apr  1 13:18:34 2013
New Revision: 248973
URL: http://svnweb.freebsd.org/changeset/base/248973

Log:
  Slightly tune locking to not call xpt_alloc_ccb() that is allowed to sleep
  while holding the SIM mutex.

Modified:
  head/sys/dev/tws/tws_cam.c
  head/sys/dev/tws/tws_user.c

Modified: head/sys/dev/tws/tws_cam.c
==============================================================================
--- head/sys/dev/tws/tws_cam.c	Mon Apr  1 13:17:28 2013	(r248972)
+++ head/sys/dev/tws/tws_cam.c	Mon Apr  1 13:18:34 2013	(r248973)
@@ -217,17 +217,16 @@ tws_bus_scan(struct tws_softc *sc)
     TWS_TRACE_DEBUG(sc, "entry", sc, 0);
     if (!(sc->sim))
         return(ENXIO);
-    mtx_assert(&sc->sim_lock, MA_OWNED);
-    if ((ccb = xpt_alloc_ccb()) == NULL)
-		    return(ENOMEM);
-
+    ccb = xpt_alloc_ccb();
+    mtx_lock(&sc->sim_lock);
     if (xpt_create_path(&ccb->ccb_h.path, xpt_periph, cam_sim_path(sc->sim),
                   CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
+	mtx_unlock(&sc->sim_lock);
         xpt_free_ccb(ccb);
         return(EIO);
     }
     xpt_rescan(ccb);
-    
+    mtx_unlock(&sc->sim_lock);
     return(0);
 }
 

Modified: head/sys/dev/tws/tws_user.c
==============================================================================
--- head/sys/dev/tws/tws_user.c	Mon Apr  1 13:17:28 2013	(r248972)
+++ head/sys/dev/tws/tws_user.c	Mon Apr  1 13:18:34 2013	(r248973)
@@ -73,9 +73,7 @@ tws_ioctl(struct cdev *dev, u_long cmd, 
             break;
         case TWS_IOCTL_SCAN_BUS :
             TWS_TRACE_DEBUG(sc, "scan-bus", 0, 0);
-            mtx_lock(&sc->sim_lock);
             error = tws_bus_scan(sc);
-            mtx_unlock(&sc->sim_lock);
             break;
         default :
             TWS_TRACE_DEBUG(sc, "ioctl-aen", cmd, buf);



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