From: Christoph Hellwig <hch@lst.de>
To: James.Bottomley@steeleye.com, gibbs@scsiguy.com
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] allow drivers to hook into watchdog timeout
Date: Tue, 20 Jan 2004 14:20:52 +0100 [thread overview]
Message-ID: <20040120132052.GA6740@lst.de> (raw)
We all know talk is cheap, so here's a first draft patch to allow LLDDs
to get control first after a command timeout. Justin, does this look
okay for you? BTW, your drivers are the last ones using scsi_add_timer
from outside the midlayer, if we could get rid of that we'd be able to
keep the interface private.
===== drivers/scsi/scsi.c 1.134 vs edited =====
--- 1.134/drivers/scsi/scsi.c Sat Jan 10 21:37:37 2004
+++ edited/drivers/scsi/scsi.c Tue Jan 20 14:18:51 2004
@@ -484,6 +484,28 @@
}
#endif
+/**
+ * scsi_times_out - Timeout handler for normal scsi commands.
+ * @scmd: Cmd that is timing out.
+ *
+ * Notes:
+ * We do not need to lock this. There is the potential for a race
+ * only in that the normal completion handling might run, but if the
+ * normal completion function determines that the timer has already
+ * fired, then it mustn't do anything.
+ */
+static void scsi_times_out(struct scsi_cmnd *scmd)
+{
+ scsi_log_completion(scmd, TIMEOUT_ERROR);
+
+ if (scmd->device->host->hostt->eh_timeout) {
+ scmd->device->host->hostt->eh_timeout(scmd);
+ } else if (unlikely(!scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) {
+ panic("Error handler thread not present at %p %p %s %d",
+ scmd, scmd->device->host, __FILE__, __LINE__);
+ }
+}
+
/*
* Function: scsi_dispatch_command
*
===== drivers/scsi/scsi_error.c 1.69 vs edited =====
--- 1.69/drivers/scsi/scsi_error.c Thu Jan 15 23:14:40 2004
+++ edited/drivers/scsi/scsi_error.c Tue Jan 20 14:18:56 2004
@@ -153,25 +153,6 @@
}
/**
- * scsi_times_out - Timeout function for normal scsi commands.
- * @scmd: Cmd that is timing out.
- *
- * Notes:
- * We do not need to lock this. There is the potential for a race
- * only in that the normal completion handling might run, but if the
- * normal completion function determines that the timer has already
- * fired, then it mustn't do anything.
- **/
-void scsi_times_out(struct scsi_cmnd *scmd)
-{
- scsi_log_completion(scmd, TIMEOUT_ERROR);
- if (unlikely(!scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) {
- panic("Error handler thread not present at %p %p %s %d",
- scmd, scmd->device->host, __FILE__, __LINE__);
- }
-}
-
-/**
* scsi_block_when_processing_errors - Prevent cmds from being queued.
* @sdev: Device on which we are performing recovery.
*
===== drivers/scsi/scsi_priv.h 1.30 vs edited =====
--- 1.30/drivers/scsi/scsi_priv.h Mon Sep 29 14:37:28 2003
+++ edited/drivers/scsi/scsi_priv.h Tue Jan 20 14:17:30 2004
@@ -100,11 +100,9 @@
extern void scsi_exit_devinfo(void);
/* scsi_error.c */
-extern void scsi_times_out(struct scsi_cmnd *cmd);
extern int scsi_error_handler(void *host);
extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
extern void scsi_eh_wakeup(struct Scsi_Host *shost);
-extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
/* scsi_lib.c */
extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
===== include/scsi/scsi_eh.h 1.1 vs edited =====
--- 1.1/include/scsi/scsi_eh.h Mon Jun 9 00:03:00 2003
+++ edited/include/scsi/scsi_eh.h Tue Jan 20 14:17:27 2004
@@ -4,6 +4,7 @@
extern void scsi_add_timer(struct scsi_cmnd *, int,
void (*)(struct scsi_cmnd *));
extern int scsi_delete_timer(struct scsi_cmnd *);
+extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
extern void scsi_report_bus_reset(struct Scsi_Host *, int);
extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
extern int scsi_block_when_processing_errors(struct scsi_device *);
===== include/scsi/scsi_host.h 1.13 vs edited =====
--- 1.13/include/scsi/scsi_host.h Wed Nov 12 15:15:46 2003
+++ edited/include/scsi/scsi_host.h Tue Jan 20 14:11:46 2004
@@ -125,6 +125,11 @@
int (* eh_host_reset_handler)(struct scsi_cmnd *);
/*
+ * Timeout handler. Optional.
+ */
+ void (* eh_timeout)(struct scsi_cmnd *);
+
+ /*
* Old EH handlers, no longer used. Make them warn the user of old
* drivers by using a wrong type
*
next reply other threads:[~2004-01-20 13:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-20 13:20 Christoph Hellwig [this message]
2004-01-20 15:53 ` [PATCH] allow drivers to hook into watchdog timeout Mike Anderson
2004-01-20 16:00 ` Christoph Hellwig
2004-01-20 16:47 ` Mike Anderson
2004-01-22 13:59 ` Christoph Hellwig
2004-01-22 14:27 ` Justin T. Gibbs
2004-01-20 17:00 ` Brian King
2004-01-20 18:06 ` Christoph Hellwig
2004-02-10 16:34 ` Justin T. Gibbs
2004-02-10 16:42 ` James Bottomley
2004-02-10 17:47 ` Justin T. Gibbs
2004-02-10 18:41 ` James Bottomley
2004-02-10 19:44 ` Justin T. Gibbs
2004-02-10 20:05 ` James Bottomley
2004-02-10 20:26 ` Justin T. Gibbs
2004-02-10 22:47 ` Clay Haapala
2004-02-11 20:05 ` James Bottomley
2004-02-12 0:15 ` Justin T. Gibbs
2004-02-12 14:42 ` 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=20040120132052.GA6740@lst.de \
--to=hch@lst.de \
--cc=James.Bottomley@steeleye.com \
--cc=gibbs@scsiguy.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 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.