Commit ae0751ffc77e7f21629970fdab5528c573e637f8

Authored by Lin Ming
Committed by Jeff Garzik
1 parent 9a6d6a2dda

[SCSI] add flag to skip the runtime PM calls on the host

With previous change, now the ata port runtime suspend will happen as:

disk suspend --> scsi target suspend --> scsi host suspend --> ata port
suspend

ata port(parent device) suspend need to schedule scsi EH which will resume
scsi host(child device). Then the child device resume will in turn make
parent device resume first. This is kind of recursive.

This patch adds a new flag Scsi_Host::eh_noresume.
ata port will set this flag to skip the runtime PM calls on scsi host.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

Showing 2 changed files with 6 additions and 2 deletions Side-by-side Diff

drivers/scsi/scsi_error.c
... ... @@ -1812,7 +1812,7 @@
1812 1812 * what we need to do to get it up and online again (if we can).
1813 1813 * If we fail, we end up taking the thing offline.
1814 1814 */
1815   - if (scsi_autopm_get_host(shost) != 0) {
  1815 + if (!shost->eh_noresume && scsi_autopm_get_host(shost) != 0) {
1816 1816 SCSI_LOG_ERROR_RECOVERY(1,
1817 1817 printk(KERN_ERR "Error handler scsi_eh_%d "
1818 1818 "unable to autoresume\n",
... ... @@ -1833,7 +1833,8 @@
1833 1833 * which are still online.
1834 1834 */
1835 1835 scsi_restart_operations(shost);
1836   - scsi_autopm_put_host(shost);
  1836 + if (!shost->eh_noresume)
  1837 + scsi_autopm_put_host(shost);
1837 1838 set_current_state(TASK_INTERRUPTIBLE);
1838 1839 }
1839 1840 __set_current_state(TASK_RUNNING);
include/scsi/scsi_host.h
... ... @@ -669,6 +669,9 @@
669 669 /* Asynchronous scan in progress */
670 670 unsigned async_scan:1;
671 671  
  672 + /* Don't resume host in EH */
  673 + unsigned eh_noresume:1;
  674 +
672 675 /*
673 676 * Optional work queue to be utilized by the transport
674 677 */