提交 793698ce 编写于 作者: P Patrick Mansfield 提交者: James Bottomley

[SCSI] saved and restore result for timed out commands

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: NPatrick Mansfield <patmans@us.ibm.com>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 ad34ea2c
...@@ -768,6 +768,7 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd) ...@@ -768,6 +768,7 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd)
{ {
static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0}; static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0};
int retry_cnt = 1, rtn; int retry_cnt = 1, rtn;
int saved_result;
retry_tur: retry_tur:
memcpy(scmd->cmnd, tur_command, sizeof(tur_command)); memcpy(scmd->cmnd, tur_command, sizeof(tur_command));
...@@ -778,6 +779,7 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd) ...@@ -778,6 +779,7 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd)
*/ */
memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer));
saved_result = scmd->result;
scmd->request_buffer = NULL; scmd->request_buffer = NULL;
scmd->request_bufflen = 0; scmd->request_bufflen = 0;
scmd->use_sg = 0; scmd->use_sg = 0;
...@@ -792,6 +794,7 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd) ...@@ -792,6 +794,7 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd)
* the original request, so let's restore the original data. (db) * the original request, so let's restore the original data. (db)
*/ */
scsi_setup_cmd_retry(scmd); scsi_setup_cmd_retry(scmd);
scmd->result = saved_result;
/* /*
* hey, we are done. let's look to see what happened. * hey, we are done. let's look to see what happened.
...@@ -894,6 +897,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) ...@@ -894,6 +897,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd)
{ {
static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0};
int rtn; int rtn;
int saved_result;
if (!scmd->device->allow_restart) if (!scmd->device->allow_restart)
return 1; return 1;
...@@ -906,6 +910,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) ...@@ -906,6 +910,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd)
*/ */
memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer));
saved_result = scmd->result;
scmd->request_buffer = NULL; scmd->request_buffer = NULL;
scmd->request_bufflen = 0; scmd->request_bufflen = 0;
scmd->use_sg = 0; scmd->use_sg = 0;
...@@ -920,6 +925,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) ...@@ -920,6 +925,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd)
* the original request, so let's restore the original data. (db) * the original request, so let's restore the original data. (db)
*/ */
scsi_setup_cmd_retry(scmd); scsi_setup_cmd_retry(scmd);
scmd->result = saved_result;
/* /*
* hey, we are done. let's look to see what happened. * hey, we are done. let's look to see what happened.
...@@ -1559,6 +1565,11 @@ static void scsi_eh_flush_done_q(struct list_head *done_q) ...@@ -1559,6 +1565,11 @@ static void scsi_eh_flush_done_q(struct list_head *done_q)
scmd)); scmd));
scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY);
} else { } 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) if (!scmd->result)
scmd->result |= (DRIVER_TIMEOUT << 24); scmd->result |= (DRIVER_TIMEOUT << 24);
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish" SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册