From: Mike Anderson <andmike@us.ibm.com>
To: linux-scsi@vger.kernel.org
Subject: Re: [PATCH / RFC] scsi_error handler update. (4/4)
Date: Tue, 11 Feb 2003 00:19:03 -0800 [thread overview]
Message-ID: <20030211081903.GD1368@beaverton.ibm.com> (raw)
In-Reply-To: <20030211081744.GC1368@beaverton.ibm.com>
This patch series is against scsi-misc-2.5.
03_serror-dev-offline-1.diff:
- Add scsi_set_device_offline interface.
-andmike
--
Michael Anderson
andmike@us.ibm.com
scsi.c | 38 ++++++++++++++++++++++++++++++++++++++
scsi.h | 1 +
scsi_syms.c | 1 +
3 files changed, 40 insertions(+)
------
diff -Nru a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
--- a/drivers/scsi/scsi.c Mon Feb 10 22:25:47 2003
+++ b/drivers/scsi/scsi.c Mon Feb 10 22:25:47 2003
@@ -1519,6 +1519,44 @@
{
sdev->access_count--;
module_put(sdev->host->hostt->module);
+}
+
+/**
+ * scsi_set_device_offline - set scsi_device offline
+ * @sdev: pointer to struct scsi_device to offline.
+ *
+ * Locks: host_lock held on entry.
+ **/
+void scsi_set_device_offline(struct scsi_device *sdev)
+{
+ struct scsi_cmnd *scmd;
+ int cmds_active = 0;
+ unsigned long flags;
+
+ sdev->online = FALSE;
+
+ spin_lock_irqsave(&sdev->list_lock, flags);
+ list_for_each_entry(scmd, &sdev->cmd_list, list) {
+ if (scmd->request && scmd->request->rq_status != RQ_INACTIVE) {
+ /*
+ * If we are unable to remove the timer, it means
+ * that the command has already timed out or
+ * finished.
+ */
+ if (!scsi_delete_timer(scmd)) {
+ continue;
+ }
+
+ ++cmds_active;
+
+ scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD);
+ }
+ }
+ spin_unlock_irqrestore(&sdev->list_lock, flags);
+
+ if (!cmds_active) {
+ /* FIXME: Send online state change hotplug event */
+ }
}
/*
diff -Nru a/drivers/scsi/scsi.h b/drivers/scsi/scsi.h
--- a/drivers/scsi/scsi.h Mon Feb 10 22:25:47 2003
+++ b/drivers/scsi/scsi.h Mon Feb 10 22:25:47 2003
@@ -456,6 +456,7 @@
extern void scsi_slave_detach(struct scsi_device *);
extern int scsi_device_get(struct scsi_device *);
extern void scsi_device_put(struct scsi_device *);
+extern void scsi_set_device_offline(struct scsi_device *);
extern void scsi_done(Scsi_Cmnd * SCpnt);
extern void scsi_finish_command(Scsi_Cmnd *);
extern int scsi_retry_command(Scsi_Cmnd *);
diff -Nru a/drivers/scsi/scsi_syms.c b/drivers/scsi/scsi_syms.c
--- a/drivers/scsi/scsi_syms.c Mon Feb 10 22:25:47 2003
+++ b/drivers/scsi/scsi_syms.c Mon Feb 10 22:25:47 2003
@@ -80,6 +80,7 @@
EXPORT_SYMBOL(scsi_slave_detach);
EXPORT_SYMBOL(scsi_device_get);
EXPORT_SYMBOL(scsi_device_put);
+EXPORT_SYMBOL(scsi_set_device_offline);
/*
* This symbol is for the highlevel drivers (e.g. sg) only.
next prev parent reply other threads:[~2003-02-11 8:17 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-11 8:13 [PATCH / RFC] scsi_error handler update. (1/4) Mike Anderson
2003-02-11 8:15 ` [PATCH / RFC] scsi_error handler update. (2/4) Mike Anderson
2003-02-11 8:17 ` [PATCH / RFC] scsi_error handler update. (3/4) Mike Anderson
2003-02-11 8:19 ` Mike Anderson [this message]
2003-02-11 22:38 ` James Bottomley
2003-02-12 7:16 ` Mike Anderson
2003-02-12 14:26 ` Luben Tuikov
2003-02-12 14:37 ` James Bottomley
2003-02-12 22:34 ` James Bottomley
2003-02-13 8:24 ` Mike Anderson
2003-02-11 16:49 ` [PATCH / RFC] scsi_error handler update. (1/4) Luben Tuikov
2003-02-11 17:22 ` Mike Anderson
2003-02-11 19:05 ` Luben Tuikov
2003-02-11 20:14 ` Luben Tuikov
2003-02-11 21:14 ` Mike Anderson
[not found] ` <3E495862.3050709@splentec.com>
2003-02-11 21:20 ` Mike Anderson
2003-02-11 21:22 ` Luben Tuikov
2003-02-11 22:41 ` Christoph Hellwig
2003-02-12 20:10 ` Luben Tuikov
2003-02-12 20:46 ` Christoph Hellwig
2003-02-12 21:23 ` Mike Anderson
2003-02-12 22:15 ` Luben Tuikov
2003-02-12 21:46 ` Luben Tuikov
2003-02-13 15:47 ` Christoph Hellwig
2003-02-13 18:55 ` Luben Tuikov
2003-02-14 0:24 ` Doug Ledford
2003-02-14 16:38 ` Patrick Mansfield
2003-02-14 16:58 ` Mike Anderson
2003-02-14 18:50 ` Doug Ledford
2003-02-14 19:35 ` Luben Tuikov
2003-02-14 21:20 ` James Bottomley
2003-02-17 17:20 ` Luben Tuikov
2003-02-17 17:58 ` James Bottomley
2003-02-17 18:29 ` Luben Tuikov
2003-02-18 5:37 ` Andre Hedrick
2003-02-18 19:46 ` Luben Tuikov
2003-02-18 22:16 ` Andre Hedrick
2003-02-18 23:35 ` Luben Tuikov
2003-02-17 20:17 ` Doug Ledford
2003-02-17 20:19 ` Matthew Jacob
2003-02-17 21:12 ` Luben Tuikov
2003-02-17 17:35 ` Luben Tuikov
2003-02-14 21:27 ` James Bottomley
2003-02-17 17:28 ` Luben Tuikov
2003-02-16 4:23 ` Andre Hedrick
2003-02-11 18:00 ` Patrick Mansfield
2003-02-11 18:44 ` Mike Anderson
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=20030211081903.GD1368@beaverton.ibm.com \
--to=andmike@us.ibm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox