Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: eacfbf74196f ("power: freeze filesystems during suspend/resume")
Signed-off-by: Zihuan Zhang <zhangzihuan@kylinos.cn>
Link: https://patch.msgid.link/20250712030824.81474-1-zhangzihuan@kylinos.cn
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Zihuan Zhang and committed by
Rafael J. Wysocki
228b9ded 75b63ce2

+1 -3
+1 -3
kernel/power/suspend.c
··· 384 384 return 0; 385 385 386 386 dpm_save_failed_step(SUSPEND_FREEZE); 387 + filesystems_thaw(); 387 388 pm_notifier_call_chain(PM_POST_SUSPEND); 388 389 Restore: 389 390 pm_restore_console(); ··· 593 592 ksys_sync_helper(); 594 593 trace_suspend_resume(TPS("sync_filesystems"), 0, false); 595 594 } 596 - if (filesystem_freeze_enabled) 597 - filesystems_freeze(); 598 595 599 596 pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]); 600 597 pm_suspend_clear_flags(); ··· 612 613 pm_pr_dbg("Finishing wakeup.\n"); 613 614 suspend_finish(); 614 615 Unlock: 615 - filesystems_thaw(); 616 616 mutex_unlock(&system_transition_mutex); 617 617 return error; 618 618 }