All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Cc: James.Bottomley@steeleye.com, Andrew Morton <akpm@osdl.org>
Subject: [Patch] Fix oops on rmmod usb-storage
Date: Wed, 29 Sep 2004 09:43:52 +0200	[thread overview]
Message-ID: <415A67B8.2080003@suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

Hi all,

I managed to (hopefully) fix an kernel Oops on rmmod usb-storage.
The Oops we got was something like:

usbcore: deregistering driver usb-storage
scsi: Device offlined - not ready after error recovery: host 0 channel 0 
id 0 lun 0
sr 0:0:0:0: Illegal state transition cancel->offline
Badness in scsi_device_set_state at drivers/scsi/scsi_lib.c:1688
  [<e12bab6e>] scsi_device_set_state+0x9e/0xd0 [scsi_mod]
  [<e12b8a6e>] scsi_eh_offline_sdevs+0x4e/0x70 [scsi_mod]
  [<e12b8f1a>] scsi_unjam_host+0x9a/0x1b0 [scsi_mod]
  [<e12b90f5>] scsi_error_handler+0xc5/0x160 [scsi_mod]
  [<e12b9030>] scsi_error_handler+0x0/0x160 [scsi_mod]
  [<c0104255>] kernel_thread_helper+0x5/0x10

It turned out that in drivers/scsi/hosts.c:scsi_remove_host()
first the host is removed with scsi_forget_host() and _then_ all 
outstanding I/O to this host is cancelled with scsi_host_cancel(). 
Sounds a bit fishy as scsi_host_cancel() tries to talk to a host which 
we just have deleted ...
(Incidentally, this is most likely the same bug as Bug #2752 and #3480 
from bugme.osdl.org :-).
(And also #133249 from bugzilla.redhat.com :-).

The attached patch corrects this.
Please apply.

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: remove_scsi_host_after_cancel.patch --]
[-- Type: text/x-patch, Size: 799 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/09/29 09:27:51+02:00 hare@lammermuir.suse.de 
#   We really should cancel I/O requests before removing the host.
#   
#   Signed-off-by: Hannes Reinecke <hare@suse.de>
# 
# drivers/scsi/hosts.c
#   2004/09/29 09:27:46+02:00 hare@lammermuir.suse.de +1 -1
#   Change ordering to cancel I/O-request before removing the host.
# 
diff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
--- a/drivers/scsi/hosts.c	2004-09-29 09:29:19 +02:00
+++ b/drivers/scsi/hosts.c	2004-09-29 09:29:19 +02:00
@@ -75,8 +75,8 @@
  **/
 void scsi_remove_host(struct Scsi_Host *shost)
 {
-	scsi_forget_host(shost);
 	scsi_host_cancel(shost, 0);
+	scsi_forget_host(shost);
 	scsi_proc_host_rm(shost);
 
 	set_bit(SHOST_DEL, &shost->shost_state);

             reply	other threads:[~2004-09-29  7:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-29  7:43 Hannes Reinecke [this message]
2004-09-29 12:03 ` [Patch] Fix oops on rmmod usb-storage 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
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=415A67B8.2080003@suse.de \
    --to=hare@suse.de \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.