]> Pileus Git - ~andy/linux/blobdiff - drivers/scsi/scsi_error.c
Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~andy/linux] / drivers / scsi / scsi_error.c
index c60cffbefa3c4a0a7218ba801c992567db74a962..2bf98469dc4c6df096def2338de1670a72605ba0 100644 (file)
@@ -1775,6 +1775,14 @@ int scsi_error_handler(void *data)
                 * what we need to do to get it up and online again (if we can).
                 * If we fail, we end up taking the thing offline.
                 */
+               if (scsi_autopm_get_host(shost) != 0) {
+                       SCSI_LOG_ERROR_RECOVERY(1,
+                               printk(KERN_ERR "Error handler scsi_eh_%d "
+                                               "unable to autoresume\n",
+                                               shost->host_no));
+                       continue;
+               }
+
                if (shost->transportt->eh_strategy_handler)
                        shost->transportt->eh_strategy_handler(shost);
                else
@@ -1788,6 +1796,7 @@ int scsi_error_handler(void *data)
                 * which are still online.
                 */
                scsi_restart_operations(shost);
+               scsi_autopm_put_host(shost);
                set_current_state(TASK_INTERRUPTIBLE);
        }
        __set_current_state(TASK_RUNNING);
@@ -1885,12 +1894,16 @@ scsi_reset_provider_done_command(struct scsi_cmnd *scmd)
 int
 scsi_reset_provider(struct scsi_device *dev, int flag)
 {
-       struct scsi_cmnd *scmd = scsi_get_command(dev, GFP_KERNEL);
+       struct scsi_cmnd *scmd;
        struct Scsi_Host *shost = dev->host;
        struct request req;
        unsigned long flags;
        int rtn;
 
+       if (scsi_autopm_get_host(shost) < 0)
+               return FAILED;
+
+       scmd = scsi_get_command(dev, GFP_KERNEL);
        blk_rq_init(NULL, &req);
        scmd->request = &req;
 
@@ -1947,6 +1960,7 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
        scsi_run_host_queues(shost);
 
        scsi_next_command(scmd);
+       scsi_autopm_put_host(shost);
        return rtn;
 }
 EXPORT_SYMBOL(scsi_reset_provider);