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
This commit is contained in:
Andrew Thompson 2009-10-20 21:29:46 +00:00
parent 48d0c039cb
commit 11cf5c2f81

View File

@ -2860,8 +2860,9 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb)
{
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;
}