Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Apr 2007 20:47:15 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 119023 for review
Message-ID:  <200704302047.l3UKlFYR004720@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119023

Change 119023 by hselasky@hselasky_mini_itx on 2007/04/30 20:46:29

	Try to fix some issues with Scott's new Giant-free CAM layer.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/umass.c#14 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/umass.c#14 (text+ko) ====

@@ -1274,15 +1274,13 @@
 	sc->sc_last_xfer_index = UMASS_T_MAX;
 
 	for (i = 0; i < UMASS_T_MAX; i++) {
-	    if (sc->sc_xfer[i]) {
-	        usbd_transfer_stop(sc->sc_xfer[i]);
-	    }
+		usbd_transfer_stop(sc->sc_xfer[i]);
 	}
 
+	umass_cam_detach_sim(sc);
+
 	mtx_unlock(&(sc->sc_mtx));
 
-	umass_cam_detach_sim(sc);
-
 	usbd_transfer_unsetup(sc->sc_xfer, UMASS_T_MAX);
 
 	mtx_destroy(&(sc->sc_mtx));
@@ -2286,10 +2284,15 @@
 	    return ENOMEM;
 	}
 
+	mtx_lock(&(sc->sc_mtx));
+
 	if(xpt_bus_register(sc->sc_sim, sc->sc_unit) != CAM_SUCCESS) {
+	    mtx_unlock(&(sc->sc_mtx));
 	    return ENOMEM;
 	}
 
+	mtx_unlock(&(sc->sc_mtx));
+
 	return(0);
 }
 
@@ -2331,9 +2334,12 @@
 	   return;
 	}
 
+	mtx_lock(&(sc->sc_mtx));
+
 	if (xpt_create_path(&path, xpt_periph, cam_sim_path(sc->sc_sim),
 			    CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) 
 	    != CAM_REQ_CMP) {
+	    mtx_unlock(&(sc->sc_mtx));
 	    free(ccb, M_USBDEV);
 	    return;
 	}
@@ -2344,6 +2350,8 @@
 	ccb->crcn.flags = CAM_FLAG_NONE;
 	xpt_action(ccb);
 
+	mtx_unlock(&(sc->sc_mtx));
+
 	/* The scan is in progress now. */
 
 	return;



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