From: Hannes Reinecke <hare@suse.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Mike Anderson <andmike@us.ibm.com>,
Christoph Hellwig <hch@infradead.org>,
James Bottomley <James.Bottomley@SteelEye.com>,
SCSI Mailing List <linux-scsi@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>,
Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Subject: Re: [Patch] Fix oops on rmmod usb-storage
Date: Thu, 30 Sep 2004 10:09:28 +0200 [thread overview]
Message-ID: <415BBF38.2080300@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0409291455180.1700-100000@ida.rowland.org>
[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]
Alan Stern wrote:
> On Wed, 29 Sep 2004, Mike Anderson wrote:
>
>
>>Is it possible usb storage could do something else beside just ignore
>>the commands like return them with DID_NO_CONNECT.
>>
>>In storage_disconnect it looks like you set some state, wait for the
>>current command, but do not set anything that queuecommand can look at
>>to start rejecting commands.
>
>
> No, there is a flag set: US_FLIDX_DISCONNECTING. queuecommand could use
> that to reject commands.
>
> On the other hand, considering the race between queuecommand and
> scsi_remove_host, it shouldn't matter if queuecommand accepts the
> commands. After all, it's not really possible for the SCSI core to tell
> whether queuecommand was called before or after scsi_remove_host.
>
Ok, since this is essential the same thread then on linux-scsi
(cf. "Bug: CD driver sends commands during host removal") the same
solution applies here also.
Alan, I did a different patch which omit the special case handling in
scsiglue.c and rather reorders usb_stor_control_thread. I'd prefer mine
(naturally), but any of those will do.
And yes, both patches fix the problem.
Back to the maintainer for patch inclusion.
Cheers,
Hannes
--
Dr. Hannes Reinecke hare@suse.de
SuSE Linux AG S390 & zSeries
Maxfeldstraße 5 +49 911 74053 688
90409 Nürnberg http://www.suse.de
[-- Attachment #2: usb-drop-requests-for-disconnect --]
[-- Type: text/plain, Size: 1427 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/09/30 09:59:42+02:00 hare@lammermuir.suse.de
# When a device is disconnected, we should mark the state accordingly
# and drop the packet as there is no device we could talk to.
# Fix suggested by James Bottomley.
#
# Signed-off-by: Hannes Reinecke <hare@suse.de>
#
# drivers/usb/storage/usb.c
# 2004/09/30 09:59:34+02:00 hare@lammermuir.suse.de +3 -2
# Fix SCSI command handling on disconnect.
#
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c 2004-09-30 10:09:01 +02:00
+++ b/drivers/usb/storage/usb.c 2004-09-30 10:09:01 +02:00
@@ -320,7 +320,8 @@
/* don't do anything if we are disconnecting */
if (test_bit(US_FLIDX_DISCONNECTING, &us->flags)) {
- US_DEBUGP("No command during disconnect\n");
+ US_DEBUGP("Ignoring command during disconnect\n");
+ us->srb->result = DID_NO_CONNECT << 16;
goto SkipForDisconnect;
}
@@ -374,6 +375,7 @@
/* lock access to the state */
scsi_lock(host);
+SkipForDisconnect:
/* indicate that the command is done */
if (us->srb->result != DID_ABORT << 16) {
US_DEBUGP("scsi cmd done, result=0x%x\n",
@@ -393,7 +395,6 @@
complete(&(us->notify));
/* empty the queue, reset the state, and release the lock */
-SkipForDisconnect:
us->srb = NULL;
us->sm_state = US_STATE_IDLE;
scsi_unlock(host);
next prev parent reply other threads:[~2004-09-30 8:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-29 7:43 [Patch] Fix oops on rmmod usb-storage Hannes Reinecke
2004-09-29 12:03 ` Christoph Hellwig
2004-09-29 12:31 ` Hannes Reinecke
2004-09-29 17:12 ` Mike Anderson
2004-09-29 17:19 ` James Bottomley
2004-09-29 17:22 ` Christoph Hellwig
2004-09-29 17:36 ` Mike Anderson
2004-09-29 17:38 ` Christoph Hellwig
2004-09-29 17:50 ` Alan Stern
2004-09-29 18:32 ` Mike Anderson
2004-09-29 18:58 ` Alan Stern
2004-09-30 8:09 ` Hannes Reinecke [this message]
2004-09-30 18:14 ` Alan Stern
2004-10-01 7:11 ` Hannes Reinecke
2004-10-01 16:07 ` Alan Stern
2004-09-29 17:52 ` Mike Anderson
2004-09-29 12:04 ` Alan Cox
2004-09-29 13:56 ` James Bottomley
2004-09-29 13:17 ` Alan Cox
2004-09-29 14:24 ` James Bottomley
2004-09-29 14:44 ` Hannes Reinecke
2004-09-29 15:15 ` James Bottomley
2004-09-29 15:15 ` James Bottomley
2004-09-29 15:28 ` Matthew Wilcox
2004-09-29 15:35 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=415BBF38.2080300@suse.de \
--to=hare@suse.de \
--cc=James.Bottomley@SteelEye.com \
--cc=akpm@osdl.org \
--cc=andmike@us.ibm.com \
--cc=hch@infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=mdharm-usb@one-eyed-alien.net \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.