From owner-svn-src-all@FreeBSD.ORG Tue Oct 20 21:29:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E3DD106566B; Tue, 20 Oct 2009 21:29:47 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D7478FC08; Tue, 20 Oct 2009 21:29:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9KLTlj7079053; Tue, 20 Oct 2009 21:29:47 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9KLTlXO079051; Tue, 20 Oct 2009 21:29:47 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200910202129.n9KLTlXO079051@svn.freebsd.org> From: Andrew Thompson Date: Tue, 20 Oct 2009 21:29:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198307 - head/sys/dev/usb/storage X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2009 21:29:47 -0000 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; }