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.c50
1 files changed, 9 insertions, 41 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 1de30eb83bb0..30ac116186f5 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -320,19 +320,11 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
320 "changed. The Linux SCSI layer does not " 320 "changed. The Linux SCSI layer does not "
321 "automatically adjust these parameters.\n"); 321 "automatically adjust these parameters.\n");
322 322
323 if (scmd->request->cmd_flags & REQ_HARDBARRIER) 323 /*
324 /* 324 * Pass the UA upwards for a determination in the completion
325 * barrier requests should always retry on UA 325 * functions.
326 * otherwise block will get a spurious error 326 */
327 */ 327 return SUCCESS;
328 return NEEDS_RETRY;
329 else
330 /*
331 * for normal (non barrier) commands, pass the
332 * UA upwards for a determination in the
333 * completion functions
334 */
335 return SUCCESS;
336 328
337 /* these three are not supported */ 329 /* these three are not supported */
338 case COPY_ABORTED: 330 case COPY_ABORTED:
@@ -623,7 +615,7 @@ static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
623 return rtn; 615 return rtn;
624} 616}
625 617
626static int __scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) 618static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd)
627{ 619{
628 if (!scmd->device->host->hostt->eh_abort_handler) 620 if (!scmd->device->host->hostt->eh_abort_handler)
629 return FAILED; 621 return FAILED;
@@ -631,31 +623,9 @@ static int __scsi_try_to_abort_cmd(struct scsi_cmnd *scmd)
631 return scmd->device->host->hostt->eh_abort_handler(scmd); 623 return scmd->device->host->hostt->eh_abort_handler(scmd);
632} 624}
633 625
634/**
635 * scsi_try_to_abort_cmd - Ask host to abort a running command.
636 * @scmd: SCSI cmd to abort from Lower Level.
637 *
638 * Notes:
639 * This function will not return until the user's completion function
640 * has been called. there is no timeout on this operation. if the
641 * author of the low-level driver wishes this operation to be timed,
642 * they can provide this facility themselves. helper functions in
643 * scsi_error.c can be supplied to make this easier to do.
644 */
645static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd)
646{
647 /*
648 * scsi_done was called just after the command timed out and before
649 * we had a chance to process it. (db)
650 */
651 if (scmd->serial_number == 0)
652 return SUCCESS;
653 return __scsi_try_to_abort_cmd(scmd);
654}
655
656static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) 626static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd)
657{ 627{
658 if (__scsi_try_to_abort_cmd(scmd) != SUCCESS) 628 if (scsi_try_to_abort_cmd(scmd) != SUCCESS)
659 if (scsi_try_bus_device_reset(scmd) != SUCCESS) 629 if (scsi_try_bus_device_reset(scmd) != SUCCESS)
660 if (scsi_try_target_reset(scmd) != SUCCESS) 630 if (scsi_try_target_reset(scmd) != SUCCESS)
661 if (scsi_try_bus_reset(scmd) != SUCCESS) 631 if (scsi_try_bus_reset(scmd) != SUCCESS)
@@ -781,17 +751,15 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
781 struct Scsi_Host *shost = sdev->host; 751 struct Scsi_Host *shost = sdev->host;
782 DECLARE_COMPLETION_ONSTACK(done); 752 DECLARE_COMPLETION_ONSTACK(done);
783 unsigned long timeleft; 753 unsigned long timeleft;
784 unsigned long flags;
785 struct scsi_eh_save ses; 754 struct scsi_eh_save ses;
786 int rtn; 755 int rtn;
787 756
788 scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes); 757 scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes);
789 shost->eh_action = &done; 758 shost->eh_action = &done;
790 759
791 spin_lock_irqsave(shost->host_lock, flags);
792 scsi_log_send(scmd); 760 scsi_log_send(scmd);
793 shost->hostt->queuecommand(scmd, scsi_eh_done); 761 scmd->scsi_done = scsi_eh_done;
794 spin_unlock_irqrestore(shost->host_lock, flags); 762 shost->hostt->queuecommand(shost, scmd);
795 763
796 timeleft = wait_for_completion_timeout(&done, timeout); 764 timeleft = wait_for_completion_timeout(&done, timeout);
797 765