Re: BUG: CD driver sends command during host removal

Alan Stern
2004-09-29T21:20:23Z

On Wed, 29 Sep 2004, Mike Anderson wrote:

> So now that this thread and the other thread related to similar
> shutdown issues has grown long is the next step to see if we can get the
> usb queuecommand to return DID_NO_CONNECT in this shutdown case.

Here's a patch. Mohammed, please try it out and tell us how it works. I
just wrote it, so I haven't had a chance to test it myself yet.

Alan Stern

===== drivers/usb/storage/scsiglue.c 1.84 vs edited =====
--- 1.84/drivers/usb/storage/scsiglue.c 2004-09-13 08:11:34 -04:00
+++ edited/drivers/usb/storage/scsiglue.c 2004-09-29 16:08:47 -04:00
@@ -183,6 +183,14 @@
return SCSI_MLQUEUE_HOST_BUSY;
}

+ /* fail the command if we are disconnecting */
+ if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) {
+ US_DEBUGP("Command failed for disconnect\n");
+ srb->result = DID_NO_CONNECT << 16;
+ done(srb);
+ return 0;
+ }
+
srb->scsi_done = done;
us->srb = srb;