PERFORCE change 149828 for review

Hans Petter Selasky hselasky at FreeBSD.org
Mon Sep 15 21:13:45 UTC 2008


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

Change 149828 by hselasky at hselasky_laptop001 on 2008/09/15 21:12:56

	
	Some additional mass storage fixes.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb2/storage/umass2.c#12 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb2/storage/umass2.c#12 (text+ko) ====

@@ -167,6 +167,7 @@
 #define	DPRINTF(...) do { } while (0)
 #endif
 
+#define	UMASS_GONE ((struct umass_softc *)1)
 #define	UMASS_MAXUNIT 64		/* XXX temporary */
 
 #define	UMASS_BULK_SIZE (1 << 17)
@@ -2754,6 +2755,9 @@
 		if (xpt_bus_deregister(cam_sim_path(sc->sc_sim))) {
 #if 0					/* NOTYET */
 			cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
+#else
+			/* accessing the softc is not possible after this */
+			sc->sc_sim->softc = UMASS_GONE;
 #endif
 		} else {
 			panic("%s: CAM layer is busy!\n",
@@ -2773,6 +2777,11 @@
 {
 	struct umass_softc *sc = (struct umass_softc *)sim->softc;
 
+	if (sc == UMASS_GONE) {
+		ccb->ccb_h.status = CAM_TID_INVALID;
+		xpt_done(ccb);
+		return;
+	}
 	if (sc) {
 #if (__FreeBSD_version < 700037)
 		mtx_lock(&umass_mtx);
@@ -3070,6 +3079,9 @@
 {
 	struct umass_softc *sc = (struct umass_softc *)sim->softc;
 
+	if (sc == UMASS_GONE)
+		return;
+
 	DPRINTF(sc, UDMASS_SCSI, "CAM poll\n");
 
 	usb2_do_poll(sc->sc_xfer, UMASS_T_MAX);


More information about the p4-projects mailing list