From: Mike Christie <michaelc@cs.wisc.edu>
To: linux-scsi@vger.kernel.org
Subject: [PATCH] fix oops when removing scsi_host while IO is outstanding (and when using scsi_target patches)
Date: Sat, 09 Oct 2004 08:28:36 -0700 [thread overview]
Message-ID: <416803A4.5000202@cs.wisc.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]
When trying to remove a host while IO is running I will get the folling warning,
and after these messages my log fills up with various oops.
Oct 9 04:54:44 mina kernel: target0:0:0: Illegal state transition <NULL>->cancel
Oct 9 04:54:44 mina kernel: Badness in scsi_device_set_state at drivers/scsi/scsi_lib.c:1713
Oct 9 04:54:44 mina kernel: [<c010585e>] dump_stack+0x1e/0x30
Oct 9 04:54:44 mina kernel: [<f8831316>] scsi_device_set_state+0xc6/0x130 [scsi_mod]
Oct 9 04:54:44 mina kernel: [<f88290fc>] scsi_device_cancel+0x3c/0x263 [scsi_mod]
Oct 9 04:54:44 mina kernel: [<c02c280d>] device_for_each_child+0x4d/0x80
Oct 9 04:54:44 mina kernel: [<f88293c2>] scsi_host_cancel+0x32/0xc0 [scsi_mod]
Oct 9 04:54:44 mina kernel: [<f8829472>] scsi_remove_host+0x22/0x70 [scsi_mod]
Note the target dev name and NULL state.
Basically, scsi_host_cancel is doing a device_for_each_child thinking it's
children are scsi_devices, but in the scsi-target-2.6 tree they are now
targets. The attached patch fixes this by just adding the extra
device_for_each_child loop to get to the scsi device. It was built against
the current scsi-target-2.6 tree.
Mike
[-- Attachment #2: cancel-scsi-targets.patch --]
[-- Type: text/x-patch, Size: 779 bytes --]
--- scsi-target-2.6/drivers/scsi/hosts.c 2004-10-09 07:56:54.363746835 -0700
+++ scsi-target-2.6.work/drivers/scsi/hosts.c 2004-10-09 07:49:21.287638490 -0700
@@ -55,6 +55,12 @@
return scsi_device_cancel(to_scsi_device(dev), *(int *)data);
}
+static int scsi_target_cancel_cb(struct device *dev, void *data)
+{
+ device_for_each_child(dev, data, scsi_device_cancel_cb);
+ return 0;
+}
+
/**
* scsi_host_cancel - cancel outstanding IO to this host
* @shost: pointer to struct Scsi_Host
@@ -64,7 +70,7 @@
{
set_bit(SHOST_CANCEL, &shost->shost_state);
device_for_each_child(&shost->shost_gendev, &recovery,
- scsi_device_cancel_cb);
+ scsi_target_cancel_cb);
wait_event(shost->host_wait, (!test_bit(SHOST_RECOVERY,
&shost->shost_state)));
}
next reply other threads:[~2004-10-09 15:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-09 15:28 Mike Christie [this message]
2004-10-10 10:14 ` [PATCH] fix oops when removing scsi_host while IO is outstanding (and when using scsi_target patches) Christoph Hellwig
2004-10-10 18:55 ` Mike Christie
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=416803A4.5000202@cs.wisc.edu \
--to=michaelc@cs.wisc.edu \
--cc=linux-scsi@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.