From: Patrick Mansfield <patmans@us.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@SteelEye.com>,
Doug Gilbert <dgilbert@interlog.com>,
SCSI development list <linux-scsi@vger.kernel.org>
Subject: [PATCH] saved and restore result for timed out commands
Date: Mon, 16 May 2005 10:42:15 -0700 [thread overview]
Message-ID: <20050516174215.GA23974@us.ibm.com> (raw)
In-Reply-To: <20050510225831.GA4181@us.ibm.com>
Save and restore the scmd->result, so that timed out commands do not
return the result of the TEST UNIT READY or the start/stop commands. Code
is already in place to save and restore the result for the request sense
case.
The previous version of this patch erroneously removed the "if" check,
instead add a comment as to why the "if" is needed.
Signed-off-by: Patrick Mansfield <patmans@us.ibm.com>
diff -uprN -X /home/patman/dontdiff scsi-misc-2.6.git/drivers/scsi/scsi_error.c to-res-scsi-misc-2.6.git/drivers/scsi/scsi_error.c
--- scsi-misc-2.6.git/drivers/scsi/scsi_error.c 2005-05-09 14:19:41.000000000 -0700
+++ to-res-scsi-misc-2.6.git/drivers/scsi/scsi_error.c 2005-05-16 10:01:11.000000000 -0700
@@ -770,6 +770,7 @@ static int scsi_eh_tur(struct scsi_cmnd
{
static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0};
int retry_cnt = 1, rtn;
+ int saved_result;
retry_tur:
memcpy(scmd->cmnd, tur_command, sizeof(tur_command));
@@ -780,6 +781,7 @@ retry_tur:
*/
memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer));
+ saved_result = scmd->result;
scmd->request_buffer = NULL;
scmd->request_bufflen = 0;
scmd->use_sg = 0;
@@ -794,6 +796,7 @@ retry_tur:
* the original request, so let's restore the original data. (db)
*/
scsi_setup_cmd_retry(scmd);
+ scmd->result = saved_result;
/*
* hey, we are done. let's look to see what happened.
@@ -896,6 +899,7 @@ static int scsi_eh_try_stu(struct scsi_c
{
static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0};
int rtn;
+ int saved_result;
if (!scmd->device->allow_restart)
return 1;
@@ -908,6 +912,7 @@ static int scsi_eh_try_stu(struct scsi_c
*/
memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer));
+ saved_result = scmd->result;
scmd->request_buffer = NULL;
scmd->request_bufflen = 0;
scmd->use_sg = 0;
@@ -922,6 +927,7 @@ static int scsi_eh_try_stu(struct scsi_c
* the original request, so let's restore the original data. (db)
*/
scsi_setup_cmd_retry(scmd);
+ scmd->result = saved_result;
/*
* hey, we are done. let's look to see what happened.
@@ -1561,6 +1567,11 @@ static void scsi_eh_flush_done_q(struct
scmd));
scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY);
} else {
+ /*
+ * If just we got sense for the device (called
+ * scsi_eh_get_sense), scmd->result is already
+ * set, do not set DRIVER_TIMEOUT.
+ */
if (!scmd->result)
scmd->result |= (DRIVER_TIMEOUT << 24);
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish"
next prev parent reply other threads:[~2005-05-16 17:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-10 18:51 sg driver and the error handler Alan Stern
2005-05-10 22:58 ` Patrick Mansfield
2005-05-11 11:59 ` Douglas Gilbert
2005-05-11 16:35 ` Luben Tuikov
2005-05-11 17:45 ` Patrick Mansfield
2005-05-11 17:55 ` Luben Tuikov
2005-05-11 18:02 ` Patrick Mansfield
2005-05-11 19:43 ` Alan Stern
2005-05-11 16:40 ` Luben Tuikov
2005-05-11 17:14 ` Patrick Mansfield
2005-05-16 17:42 ` Patrick Mansfield [this message]
2005-05-16 19:42 ` [PATCH] saved and restore result for timed out commands Alan Stern
2005-06-01 18:45 ` Alan Stern
2005-06-01 21:00 ` James Bottomley
2005-06-01 21:26 ` Alan Stern
2005-06-01 21:57 ` Patrick Mansfield
2005-06-03 15:21 ` James Bottomley
2005-06-03 15:35 ` Alan Stern
[not found] <20050603160921.GA32212@us.ibm.com>
2005-06-03 16:37 ` Alan Stern
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=20050516174215.GA23974@us.ibm.com \
--to=patmans@us.ibm.com \
--cc=James.Bottomley@SteelEye.com \
--cc=dgilbert@interlog.com \
--cc=linux-scsi@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox