aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_error.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r--drivers/scsi/scsi_error.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 9bc597bd13ba..1a135f38e78d 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -79,11 +79,6 @@ int scsi_eh_scmd_add(struct scsi_cmnd *scmd, int eh_flag)
79 */ 79 */
80 scmd->owner = SCSI_OWNER_ERROR_HANDLER; 80 scmd->owner = SCSI_OWNER_ERROR_HANDLER;
81 scmd->state = SCSI_STATE_FAILED; 81 scmd->state = SCSI_STATE_FAILED;
82 /*
83 * Set the serial_number_at_timeout to the current
84 * serial_number
85 */
86 scmd->serial_number_at_timeout = scmd->serial_number;
87 list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); 82 list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q);
88 set_bit(SHOST_RECOVERY, &shost->shost_state); 83 set_bit(SHOST_RECOVERY, &shost->shost_state);
89 shost->host_failed++; 84 shost->host_failed++;
@@ -481,7 +476,8 @@ static void scsi_eh_done(struct scsi_cmnd *scmd)
481 **/ 476 **/
482static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) 477static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
483{ 478{
484 struct Scsi_Host *host = scmd->device->host; 479 struct scsi_device *sdev = scmd->device;
480 struct Scsi_Host *shost = sdev->host;
485 DECLARE_MUTEX_LOCKED(sem); 481 DECLARE_MUTEX_LOCKED(sem);
486 unsigned long flags; 482 unsigned long flags;
487 int rtn = SUCCESS; 483 int rtn = SUCCESS;
@@ -492,27 +488,27 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
492 */ 488 */
493 scmd->owner = SCSI_OWNER_LOWLEVEL; 489 scmd->owner = SCSI_OWNER_LOWLEVEL;
494 490
495 if (scmd->device->scsi_level <= SCSI_2) 491 if (sdev->scsi_level <= SCSI_2)
496 scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | 492 scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) |
497 (scmd->device->lun << 5 & 0xe0); 493 (sdev->lun << 5 & 0xe0);
498 494
499 scsi_add_timer(scmd, timeout, scsi_eh_times_out); 495 scsi_add_timer(scmd, timeout, scsi_eh_times_out);
500 496
501 /* 497 /*
502 * set up the semaphore so we wait for the command to complete. 498 * set up the semaphore so we wait for the command to complete.
503 */ 499 */
504 scmd->device->host->eh_action = &sem; 500 shost->eh_action = &sem;
505 scmd->request->rq_status = RQ_SCSI_BUSY; 501 scmd->request->rq_status = RQ_SCSI_BUSY;
506 502
507 spin_lock_irqsave(scmd->device->host->host_lock, flags); 503 spin_lock_irqsave(shost->host_lock, flags);
508 scsi_log_send(scmd); 504 scsi_log_send(scmd);
509 host->hostt->queuecommand(scmd, scsi_eh_done); 505 shost->hostt->queuecommand(scmd, scsi_eh_done);
510 spin_unlock_irqrestore(scmd->device->host->host_lock, flags); 506 spin_unlock_irqrestore(shost->host_lock, flags);
511 507
512 down(&sem); 508 down(&sem);
513 scsi_log_completion(scmd, SUCCESS); 509 scsi_log_completion(scmd, SUCCESS);
514 510
515 scmd->device->host->eh_action = NULL; 511 shost->eh_action = NULL;
516 512
517 /* 513 /*
518 * see if timeout. if so, tell the host to forget about it. 514 * see if timeout. if so, tell the host to forget about it.
@@ -532,10 +528,10 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout)
532 * abort a timed out command or not. not sure how 528 * abort a timed out command or not. not sure how
533 * we should treat them differently anyways. 529 * we should treat them differently anyways.
534 */ 530 */
535 spin_lock_irqsave(scmd->device->host->host_lock, flags); 531 spin_lock_irqsave(shost->host_lock, flags);
536 if (scmd->device->host->hostt->eh_abort_handler) 532 if (shost->hostt->eh_abort_handler)
537 scmd->device->host->hostt->eh_abort_handler(scmd); 533 shost->hostt->eh_abort_handler(scmd);
538 spin_unlock_irqrestore(scmd->device->host->host_lock, flags); 534 spin_unlock_irqrestore(shost->host_lock, flags);
539 535
540 scmd->request->rq_status = RQ_SCSI_DONE; 536 scmd->request->rq_status = RQ_SCSI_DONE;
541 scmd->owner = SCSI_OWNER_ERROR_HANDLER; 537 scmd->owner = SCSI_OWNER_ERROR_HANDLER;
@@ -1061,7 +1057,6 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd)
1061 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n", 1057 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n",
1062 __FUNCTION__)); 1058 __FUNCTION__));
1063 scmd->owner = SCSI_OWNER_LOWLEVEL; 1059 scmd->owner = SCSI_OWNER_LOWLEVEL;
1064 scmd->serial_number_at_timeout = scmd->serial_number;
1065 1060
1066 if (!scmd->device->host->hostt->eh_bus_reset_handler) 1061 if (!scmd->device->host->hostt->eh_bus_reset_handler)
1067 return FAILED; 1062 return FAILED;
@@ -1093,7 +1088,6 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)
1093 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n", 1088 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n",
1094 __FUNCTION__)); 1089 __FUNCTION__));
1095 scmd->owner = SCSI_OWNER_LOWLEVEL; 1090 scmd->owner = SCSI_OWNER_LOWLEVEL;
1096 scmd->serial_number_at_timeout = scmd->serial_number;
1097 1091
1098 if (!scmd->device->host->hostt->eh_host_reset_handler) 1092 if (!scmd->device->host->hostt->eh_host_reset_handler)
1099 return FAILED; 1093 return FAILED;
@@ -1313,6 +1307,9 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
1313 case DID_IMM_RETRY: 1307 case DID_IMM_RETRY:
1314 return NEEDS_RETRY; 1308 return NEEDS_RETRY;
1315 1309
1310 case DID_REQUEUE:
1311 return ADD_TO_MLQUEUE;
1312
1316 case DID_ERROR: 1313 case DID_ERROR:
1317 if (msg_byte(scmd->result) == COMMAND_COMPLETE && 1314 if (msg_byte(scmd->result) == COMMAND_COMPLETE &&
1318 status_byte(scmd->result) == RESERVATION_CONFLICT) 1315 status_byte(scmd->result) == RESERVATION_CONFLICT)
@@ -1839,7 +1836,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
1839 scmd->bufflen = 0; 1836 scmd->bufflen = 0;
1840 scmd->request_buffer = NULL; 1837 scmd->request_buffer = NULL;
1841 scmd->request_bufflen = 0; 1838 scmd->request_bufflen = 0;
1842 scmd->internal_timeout = NORMAL_TIMEOUT;
1843 scmd->abort_reason = DID_ABORT; 1839 scmd->abort_reason = DID_ABORT;
1844 1840
1845 scmd->cmd_len = 0; 1841 scmd->cmd_len = 0;