Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Sep 2008 21:13:44 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 149828 for review
Message-ID:  <200809152113.m8FLDijY015513@repoman.freebsd.org>

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

Change 149828 by hselasky@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);



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