Commit 042f99c4 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branch 'pm-sleep'

Merge fixes related to system sleep for 7.0-rc6:

 - Prevent pm_restore_gfp_mask() from triggering a WARN_ON() in some
   code paths in which it is legitimately called without invoking
   pm_restrict_gfp_mask() previously (Youngjun Park)

 - Update snapshot_write_finalize() to take trailing zero pages into
   account properly which prevents user space restore from failing
   subsequently in some cases (Alberto Garcia)

* pm-sleep:
  PM: sleep: Drop spurious WARN_ON() from pm_restore_gfp_mask()
  PM: hibernate: Drain trailing zero pages on userspace restore
parents 6a28fb8c a8d51efb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ void pm_restore_gfp_mask(void)
{
	WARN_ON(!mutex_is_locked(&system_transition_mutex));

	if (WARN_ON(!saved_gfp_count) || --saved_gfp_count)
	if (!saved_gfp_count || --saved_gfp_count)
		return;

	gfp_allowed_mask = saved_gfp_mask;
+11 −0
Original line number Diff line number Diff line
@@ -2855,6 +2855,17 @@ int snapshot_write_finalize(struct snapshot_handle *handle)
{
	int error;

	/*
	 * Call snapshot_write_next() to drain any trailing zero pages,
	 * but make sure we're in the data page region first.
	 * This function can return PAGE_SIZE if the kernel was expecting
	 * another copy page. Return -ENODATA in that situation.
	 */
	if (handle->cur > nr_meta_pages + 1) {
		error = snapshot_write_next(handle);
		if (error)
			return error > 0 ? -ENODATA : error;
	}
	copy_last_highmem_page();
	error = hibernate_restore_protect_page(handle->buffer);
	/* Do that only if we have loaded the image entirely */