From a739fc533d14fdee28c52a251db5ae27af994d16 Mon Sep 17 00:00:00 2001 From: Matthew Dharm Date: Thu, 28 Jul 2005 14:45:50 -0700 Subject: [PATCH] --- yaml --- r: 7959 b: refs/heads/master c: 26186ba77b493204ae0fadc3c88a67b14f22168f h: refs/heads/master i: 7957: b66e5080b5d869d1be45adf8d2046b0ca4698e02 7955: 5e5c2942ba40f12af899533f4bcde6deb439189a 7951: 4dc28e0ff33534926f055bed1d66554971a47773 v: v3 --- [refs] | 2 +- trunk/drivers/usb/storage/usb.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 5ae8eaa9bb72..57ffab58c28d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 77f46328fb83b64befd889ebce6d7fb959932509 +refs/heads/master: 26186ba77b493204ae0fadc3c88a67b14f22168f diff --git a/trunk/drivers/usb/storage/usb.c b/trunk/drivers/usb/storage/usb.c index 255771151399..97b9ebb8a082 100644 --- a/trunk/drivers/usb/storage/usb.c +++ b/trunk/drivers/usb/storage/usb.c @@ -833,6 +833,19 @@ static void quiesce_and_remove_host(struct us_data *us) /* Wait for the current command to finish, then remove the host */ down(&us->dev_semaphore); up(&us->dev_semaphore); + + /* queuecommand won't accept any new commands and the control + * thread won't execute a previously-queued command. If there + * is such a command pending, complete it with an error. */ + if (us->srb) { + us->srb->result = DID_NO_CONNECT << 16; + scsi_lock(us_to_host(us)); + us->srb->scsi_done(us->srb); + us->srb = NULL; + scsi_unlock(us_to_host(us)); + } + + /* Now we own no commands so it's safe to remove the SCSI host */ scsi_remove_host(us_to_host(us)); }