PERFORCE change 119023 for review

Hans Petter Selasky hselasky at FreeBSD.org
Mon Apr 30 20:47:16 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=119023

Change 119023 by hselasky at 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;


More information about the p4-projects mailing list