All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] PM: hibernate: Fix swap file marking
@ 2021-01-22 16:19 Laurent Badel
  2021-01-22 16:19 ` [PATCH 1/1] PM: hibernate: flush swap writer after marking Laurent Badel
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Badel @ 2021-01-22 16:19 UTC (permalink / raw)
  To: Rafael J . Wysocki, Pavel Machek, linux-pm; +Cc: Laurent Badel

It seems that the swap writer might need be flushed after marking the 
signature into the swap files, otherwise the system may power off before
the signature is written. This is what happened on my system (the swap 
file was missing the hibernation signature) and this patch allowed it
to restore from the hibernation image. 

I don't know if it might be due to a peculiarity of the system I am using,
it is a custom board with an iMX28 SoC and the hibernation image is stored
on the gpmi nand flash.

Best regards,

Laurent

Laurent Badel (1):
  PM: hibernate: flush swap writer after marking

 kernel/power/swap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.17.1



-----------------------------
Eaton Industries Manufacturing GmbH ~ Registered place of business: Route de la Longeraie 7, 1110, Morges, Switzerland 

-----------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] PM: hibernate: flush swap writer after marking
  2021-01-22 16:19 [PATCH 0/1] PM: hibernate: Fix swap file marking Laurent Badel
@ 2021-01-22 16:19 ` Laurent Badel
  2021-01-25 17:55   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Badel @ 2021-01-22 16:19 UTC (permalink / raw)
  To: Rafael J . Wysocki, Pavel Machek, linux-pm; +Cc: Laurent Badel

Flush the swap writer after, not before, marking the files, to ensure the
signature is properly written. 

Signed-off-by: Laurent Badel <laurentbadel@eaton.com>
---
 kernel/power/swap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index c73f2e295167..72e33054a2e1 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -497,10 +497,10 @@ static int swap_writer_finish(struct swap_map_handle *handle,
 		unsigned int flags, int error)
 {
 	if (!error) {
-		flush_swap_writer(handle);
 		pr_info("S");
 		error = mark_swapfiles(handle, flags);
 		pr_cont("|\n");
+		flush_swap_writer(handle);
 	}
 
 	if (error)
-- 
2.17.1



-----------------------------
Eaton Industries Manufacturing GmbH ~ Registered place of business: Route de la Longeraie 7, 1110, Morges, Switzerland 

-----------------------------


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] PM: hibernate: flush swap writer after marking
  2021-01-22 16:19 ` [PATCH 1/1] PM: hibernate: flush swap writer after marking Laurent Badel
@ 2021-01-25 17:55   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2021-01-25 17:55 UTC (permalink / raw)
  To: Laurent Badel; +Cc: Rafael J . Wysocki, Pavel Machek, Linux PM

On Fri, Jan 22, 2021 at 5:49 PM Laurent Badel <laurentbadel@eaton.com> wrote:
>
> Flush the swap writer after, not before, marking the files, to ensure the
> signature is properly written.
>
> Signed-off-by: Laurent Badel <laurentbadel@eaton.com>
> ---
>  kernel/power/swap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/power/swap.c b/kernel/power/swap.c
> index c73f2e295167..72e33054a2e1 100644
> --- a/kernel/power/swap.c
> +++ b/kernel/power/swap.c
> @@ -497,10 +497,10 @@ static int swap_writer_finish(struct swap_map_handle *handle,
>                 unsigned int flags, int error)
>  {
>         if (!error) {
> -               flush_swap_writer(handle);
>                 pr_info("S");
>                 error = mark_swapfiles(handle, flags);
>                 pr_cont("|\n");
> +               flush_swap_writer(handle);
>         }
>
>         if (error)
> --

Applied as 5.11-rc material, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-25 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 16:19 [PATCH 0/1] PM: hibernate: Fix swap file marking Laurent Badel
2021-01-22 16:19 ` [PATCH 1/1] PM: hibernate: flush swap writer after marking Laurent Badel
2021-01-25 17:55   ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.