diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-04-24 18:16:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-24 18:31:30 -0400 |
commit | 0c8454f56623505a99463405fd7d5664adfbb094 (patch) | |
tree | 64e594f2846d997213890b59168307d12e676ff0 /kernel/power/disk.c | |
parent | 4b2b0b9753194cad44d7295c32044b89710efd70 (diff) |
PM/Hibernate: Fix waiting for image device to appear on resume
Commit c751085943362143f84346d274e0011419c84202 ("PM/Hibernate: Wait for
SCSI devices scan to complete during resume") added a call to
scsi_complete_async_scans() to software_resume(), so that it waited for
the SCSI scanning to complete, but the call was added at a wrong place.
Namely, it should have been added after wait_for_device_probe(), which
is called only if the image partition hasn't been specified yet. Also,
it's reasonable to check if the image partition is present and only wait
for the device probing and SCSI scanning to complete if it is not the
case.
Additionally, since noresume is checked right at the beginning of
software_resume() and the function returns immediately if it's set, it
doesn't make sense to check it once again later.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r-- | kernel/power/disk.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 0854770b63b9..e71ca9cd81b2 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -646,13 +646,6 @@ static int software_resume(void) | |||
646 | return 0; | 646 | return 0; |
647 | 647 | ||
648 | /* | 648 | /* |
649 | * We can't depend on SCSI devices being available after loading one of | ||
650 | * their modules if scsi_complete_async_scans() is not called and the | ||
651 | * resume device usually is a SCSI one. | ||
652 | */ | ||
653 | scsi_complete_async_scans(); | ||
654 | |||
655 | /* | ||
656 | * name_to_dev_t() below takes a sysfs buffer mutex when sysfs | 649 | * name_to_dev_t() below takes a sysfs buffer mutex when sysfs |
657 | * is configured into the kernel. Since the regular hibernate | 650 | * is configured into the kernel. Since the regular hibernate |
658 | * trigger path is via sysfs which takes a buffer mutex before | 651 | * trigger path is via sysfs which takes a buffer mutex before |
@@ -663,32 +656,42 @@ static int software_resume(void) | |||
663 | * here to avoid lockdep complaining. | 656 | * here to avoid lockdep complaining. |
664 | */ | 657 | */ |
665 | mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING); | 658 | mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING); |
659 | |||
660 | if (swsusp_resume_device) | ||
661 | goto Check_image; | ||
662 | |||
663 | if (!strlen(resume_file)) { | ||
664 | error = -ENOENT; | ||
665 | goto Unlock; | ||
666 | } | ||
667 | |||
668 | pr_debug("PM: Checking image partition %s\n", resume_file); | ||
669 | |||
670 | /* Check if the device is there */ | ||
671 | swsusp_resume_device = name_to_dev_t(resume_file); | ||
666 | if (!swsusp_resume_device) { | 672 | if (!swsusp_resume_device) { |
667 | if (!strlen(resume_file)) { | ||
668 | mutex_unlock(&pm_mutex); | ||
669 | return -ENOENT; | ||
670 | } | ||
671 | /* | 673 | /* |
672 | * Some device discovery might still be in progress; we need | 674 | * Some device discovery might still be in progress; we need |
673 | * to wait for this to finish. | 675 | * to wait for this to finish. |
674 | */ | 676 | */ |
675 | wait_for_device_probe(); | 677 | wait_for_device_probe(); |
678 | /* | ||
679 | * We can't depend on SCSI devices being available after loading | ||
680 | * one of their modules until scsi_complete_async_scans() is | ||
681 | * called and the resume device usually is a SCSI one. | ||
682 | */ | ||
683 | scsi_complete_async_scans(); | ||
684 | |||
676 | swsusp_resume_device = name_to_dev_t(resume_file); | 685 | swsusp_resume_device = name_to_dev_t(resume_file); |
677 | pr_debug("PM: Resume from partition %s\n", resume_file); | 686 | if (!swsusp_resume_device) { |
678 | } else { | 687 | error = -ENODEV; |
679 | pr_debug("PM: Resume from partition %d:%d\n", | 688 | goto Unlock; |
680 | MAJOR(swsusp_resume_device), | 689 | } |
681 | MINOR(swsusp_resume_device)); | ||
682 | } | 690 | } |
683 | 691 | ||
684 | if (noresume) { | 692 | Check_image: |
685 | /** | 693 | pr_debug("PM: Resume from partition %d:%d\n", |
686 | * FIXME: If noresume is specified, we need to find the | 694 | MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); |
687 | * partition and reset it back to normal swap space. | ||
688 | */ | ||
689 | mutex_unlock(&pm_mutex); | ||
690 | return 0; | ||
691 | } | ||
692 | 695 | ||
693 | pr_debug("PM: Checking hibernation image.\n"); | 696 | pr_debug("PM: Checking hibernation image.\n"); |
694 | error = swsusp_check(); | 697 | error = swsusp_check(); |