PERFORCE change 119056 for review

Hans Petter Selasky hselasky at FreeBSD.org
Tue May 1 08:50:13 UTC 2007


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

Change 119056 by hselasky at hselasky_mini_itx on 2007/05/01 08:50:02

	Fix some locking issues in "umass.c".
	Make locking changes in change 119023 conditional.

Affected files ...

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

Differences ...

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

@@ -1277,9 +1277,14 @@
 		usbd_transfer_stop(sc->sc_xfer[i]);
 	}
 
+#if (__FreeBSD_version < 700037)
+	mtx_unlock(&(sc->sc_mtx));
+#endif
 	umass_cam_detach_sim(sc);
 
+#if (__FreeBSD_version >= 700037)
 	mtx_unlock(&(sc->sc_mtx));
+#endif
 
 	usbd_transfer_unsetup(sc->sc_xfer, UMASS_T_MAX);
 
@@ -2284,15 +2289,20 @@
 	    return ENOMEM;
 	}
 
+#if (__FreeBSD_version >= 700037)
 	mtx_lock(&(sc->sc_mtx));
+#endif
 
 	if(xpt_bus_register(sc->sc_sim, sc->sc_unit) != CAM_SUCCESS) {
+#if (__FreeBSD_version >= 700037)
 	    mtx_unlock(&(sc->sc_mtx));
+#endif
 	    return ENOMEM;
 	}
 
+#if (__FreeBSD_version >= 700037)
 	mtx_unlock(&(sc->sc_mtx));
-
+#endif
 	return(0);
 }
 
@@ -2334,12 +2344,16 @@
 	   return;
 	}
 
+#if (__FreeBSD_version >= 700037)
 	mtx_lock(&(sc->sc_mtx));
+#endif
 
 	if (xpt_create_path(&path, xpt_periph, cam_sim_path(sc->sc_sim),
 			    CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) 
 	    != CAM_REQ_CMP) {
+#if (__FreeBSD_version >= 700037)
 	    mtx_unlock(&(sc->sc_mtx));
+#endif
 	    free(ccb, M_USBDEV);
 	    return;
 	}
@@ -2350,7 +2364,9 @@
 	ccb->crcn.flags = CAM_FLAG_NONE;
 	xpt_action(ccb);
 
+#if (__FreeBSD_version >= 700037)
 	mtx_unlock(&(sc->sc_mtx));
+#endif
 
 	/* The scan is in progress now. */
 
@@ -2411,7 +2427,9 @@
 	struct umass_softc *sc = (struct umass_softc *)sim->softc;
 
 	if (sc) {
+#if (__FreeBSD_version < 700037)
 	    mtx_lock(&(sc->sc_mtx));
+#endif
 
 	    /* The softc is still there, but marked as going away. umass_cam_detach
 	     * has not yet notified CAM of the lost device however.
@@ -2699,9 +2717,11 @@
 	}
 
  done:
+#if (__FreeBSD_version < 700037)
 	if (sc) {
 	    mtx_unlock(&(sc->sc_mtx));
 	}
+#endif
 	return;
 }
 


More information about the p4-projects mailing list