svn commit: r198307 - head/sys/dev/usb/storage

Andrew Thompson thompsa at FreeBSD.org
Tue Oct 20 21:29:47 UTC 2009


Author: thompsa
Date: Tue Oct 20 21:29:46 2009
New Revision: 198307
URL: http://svn.freebsd.org/changeset/base/198307

Log:
  Change from CAM_TID_INVALID to CAM_SEL_TIMEOUT error code when the usb device
  has been yanked, this works around a cam recounting bug when
  CAM_DEV_UNCONFIGURED is set late in the detach. In certain conditions the
  reference to the XPT device would not be released which would cause the usb
  explore thread to sleep forever on "simfree", preventing any new usb devices to
  be found/ejected on the bus.
  
  This is intended to be a quick workaround to the problem without touching CAM
  so it can be merged to 8.0.
  
  Suggested by:	mav
  MFC after:	3 days

Modified:
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/storage/umass.c
==============================================================================
--- head/sys/dev/usb/storage/umass.c	Tue Oct 20 21:27:03 2009	(r198306)
+++ head/sys/dev/usb/storage/umass.c	Tue Oct 20 21:29:46 2009	(r198307)
@@ -2860,8 +2860,9 @@ umass_cam_action(struct cam_sim *sim, un
 {
 	struct umass_softc *sc = (struct umass_softc *)sim->softc;
 
-	if (sc == UMASS_GONE) {
-		ccb->ccb_h.status = CAM_TID_INVALID;
+	if (sc == UMASS_GONE ||
+	    (sc != NULL && !usbd_device_attached(sc->sc_udev))) {
+		ccb->ccb_h.status = CAM_SEL_TIMEOUT;
 		xpt_done(ccb);
 		return;
 	}


More information about the svn-src-head mailing list