Commit 8e2d57e6 authored by Samuel Wu's avatar Samuel Wu Committed by Rafael J. Wysocki
Browse files

PM: sleep: Call pm_sleep_fs_sync() instead of ksys_sync_helper()



Replace the direct calls to ksys_sync_helper() with the new
pm_sleep_fs_sync() in suspend and hibernation code paths.

This enables the new mechanism allowing the filesystem sync phase
to be interrupted.

Suggested-by: default avatarSaravana Kannan <saravanak@google.com>
Signed-off-by: default avatarSamuel Wu <wusamuel@google.com>
Co-developed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
[ rjw: Subject and changelog edits, tags adjustment ]
Link: https://patch.msgid.link/20251119171426.4086783-3-wusamuel@google.com


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent bf8867ea
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -820,7 +820,10 @@ int hibernate(void)
	if (error)
		goto Restore;

	ksys_sync_helper();
	error = pm_sleep_fs_sync();
	if (error)
		goto Notify;

	if (filesystem_freeze_enabled)
		filesystems_freeze();

@@ -892,6 +895,7 @@ int hibernate(void)
	freezer_test_done = false;
 Exit:
	filesystems_thaw();
 Notify:
	pm_notifier_call_chain(PM_POST_HIBERNATION);
 Restore:
	pm_restore_console();
+5 −1
Original line number Diff line number Diff line
@@ -594,7 +594,11 @@ static int enter_state(suspend_state_t state)

	if (sync_on_suspend_enabled) {
		trace_suspend_resume(TPS("sync_filesystems"), 0, true);
		ksys_sync_helper();

		error = pm_sleep_fs_sync();
		if (error)
			goto Unlock;

		trace_suspend_resume(TPS("sync_filesystems"), 0, false);
	}

+3 −1
Original line number Diff line number Diff line
@@ -278,7 +278,9 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
		if (data->frozen)
			break;

		ksys_sync_helper();
		error = pm_sleep_fs_sync();
		if (error)
			break;

		error = freeze_processes();
		if (error)