Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Mar 2012 20:10:55 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232358 - head/sys/dev/usb/storage
Message-ID:  <201203012010.q21KAtwA094364@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Mar  1 20:10:54 2012
New Revision: 232358
URL: http://svn.freebsd.org/changeset/base/232358

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

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

Modified: head/sys/dev/usb/storage/umass.c
==============================================================================
--- head/sys/dev/usb/storage/umass.c	Thu Mar  1 20:03:44 2012	(r232357)
+++ head/sys/dev/usb/storage/umass.c	Thu Mar  1 20:10:54 2012	(r232358)
@@ -1056,6 +1056,11 @@ umass_detach(device_t dev)
 #if (__FreeBSD_version >= 700037)
 	mtx_lock(&sc->sc_mtx);
 #endif
+
+	/* cancel any leftover CCB's */
+
+	umass_cancel_ccb(sc);
+
 	umass_cam_detach_sim(sc);
 
 #if (__FreeBSD_version >= 700037)
@@ -1607,8 +1612,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);
 	}
 }
 



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