diff mbox series

[SRU,jammy/linux-aws,kinetic/linux-aws,12/20] UBUNTU: SAUCE: PM / hibernate: update the resume offset on SNAPSHOT_SET_SWAP_AREA

Message ID 20220817085150.2078055-16-gerald.yang@canonical.com
State New
Headers show
Series UBUNTU: SAUCE: PM: Hibernate: Enable Hibernation for Xen Based Instance Types | expand

Commit Message

Gerald Yang Aug. 17, 2022, 8:51 a.m. UTC
From: Aleksei Besogonov <cyberax@amazon.com>

BugLink: https://bugs.launchpad.net/bugs/1968062

The SNAPSHOT_SET_SWAP_AREA is supposed to be used to set the hibernation
offset on a running kernel to enable hibernating to a swap file.
However, it doesn't actually update the swsusp_resume_block variable. As
a result, the hibernation fails at the last step (after all the data is
written out) in the validation of the swap signature in
mark_swapfiles().

Before this patch, the command line processing was the only place where
swsusp_resume_block was set.

Signed-off-by: Aleksei Besogonov <cyberax@amazon.com>
Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
Signed-off-by: Anchal Agarwal <anchalag@amazon.com>
Reviewed-by: Munehisa Kamata <kamatam@amazon.com>
Reviewed-by: Eduardo Valentin <eduval@amazon.com>
CR: https://cr.amazon.com/r/8297650/
(cherry picked from commit af7ba9de0abd9cbf761e8c3feb5377c5ddf51a29 amazon-5.15.y/mainline)
Signed-off-by: Gerald Yang <gerald.yang@canonical.com>
Signed-off-by: Matthew Ruffell <matthew.ruffell@canonical.com>
---
 kernel/power/user.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/kernel/power/user.c b/kernel/power/user.c
index 740723bb3885..ba7a6431acff 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -233,6 +233,10 @@  static int snapshot_set_swap_area(struct snapshot_data *data,
 	if (data->swap < 0)
 		return swdev ? -ENODEV : -EINVAL;
 	data->dev = swdev;
+
+	swsusp_resume_device = swdev;
+	swsusp_resume_block = offset;
+
 	return 0;
 }