Skip to content

Commit 228b9de

Browse files
Zihuan Zhangrafaeljw
authored andcommitted
PM: suspend: clean up redundant filesystems_freeze/thaw() handling
The recently introduced support for freezing filesystems during system suspend included calls to filesystems_freeze() in both suspend_prepare() and enter_state(), as well as calls to filesystems_thaw() in both suspend_finish() and the Unlock path in enter_state(). These are redundant. Moreover, calling filesystems_freeze() twice, from both suspend_prepare() and enter_state(), leads to a black screen and makes the system unable to resume in some cases. Address this as follows: - filesystems_freeze() is already called in suspend_prepare(), which is the proper and consistent place to handle pre-suspend operations. The second call in enter_state() is unnecessary and so remove it. - filesystems_thaw() is invoked in suspend_finish(), which covers successful suspend/resume paths. In the failure case, add a call to filesystems_thaw() only when needed, avoiding the duplicate call in the general Unlock path. This change simplifies the suspend code and avoids repeated freeze/thaw calls, while preserving correct ordering and behavior. Fixes: eacfbf7 ("power: freeze filesystems during suspend/resume") Signed-off-by: Zihuan Zhang <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 75b63ce commit 228b9de

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

kernel/power/suspend.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ static int suspend_prepare(suspend_state_t state)
384384
return 0;
385385

386386
dpm_save_failed_step(SUSPEND_FREEZE);
387+
filesystems_thaw();
387388
pm_notifier_call_chain(PM_POST_SUSPEND);
388389
Restore:
389390
pm_restore_console();
@@ -592,8 +593,6 @@ static int enter_state(suspend_state_t state)
592593
ksys_sync_helper();
593594
trace_suspend_resume(TPS("sync_filesystems"), 0, false);
594595
}
595-
if (filesystem_freeze_enabled)
596-
filesystems_freeze();
597596

598597
pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]);
599598
pm_suspend_clear_flags();
@@ -613,7 +612,6 @@ static int enter_state(suspend_state_t state)
613612
pm_pr_dbg("Finishing wakeup.\n");
614613
suspend_finish();
615614
Unlock:
616-
filesystems_thaw();
617615
mutex_unlock(&system_transition_mutex);
618616
return error;
619617
}

0 commit comments

Comments
 (0)