svn commit: r240662 - stable/9/sys/dev/usb/storage

Hans Petter Selasky hselasky at FreeBSD.org
Tue Sep 18 16:39:04 UTC 2012


Author: hselasky
Date: Tue Sep 18 16:39:04 2012
New Revision: 240662
URL: http://svn.freebsd.org/changeset/base/240662

Log:
  MFC r232358:
  Close a detach race. Make sure all pending
  CCB's get canceled at device detach.

Modified:
  stable/9/sys/dev/usb/storage/umass.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/storage/umass.c
==============================================================================
--- stable/9/sys/dev/usb/storage/umass.c	Tue Sep 18 16:37:11 2012	(r240661)
+++ stable/9/sys/dev/usb/storage/umass.c	Tue Sep 18 16:39:04 2012	(r240662)
@@ -1046,6 +1046,11 @@ umass_detach(device_t dev)
 	usbd_transfer_unsetup(sc->sc_xfer, UMASS_T_MAX);
 
 	mtx_lock(&sc->sc_mtx);
+
+	/* cancel any leftover CCB's */
+
+	umass_cancel_ccb(sc);
+
 	umass_cam_detach_sim(sc);
 
 	mtx_unlock(&sc->sc_mtx);
@@ -1571,8 +1576,7 @@ umass_command_start(struct umass_softc *
 	if (sc->sc_xfer[sc->sc_last_xfer_index]) {
 		usbd_transfer_start(sc->sc_xfer[sc->sc_last_xfer_index]);
 	} else {
-		ccb->ccb_h.status = CAM_TID_INVALID;
-		xpt_done(ccb);
+		umass_cancel_ccb(sc);
 	}
 }
 


More information about the svn-src-stable-9 mailing list