From: Mikulas Patocka <mpatocka@redhat.com>
To: Askar Safin <safinaskar@gmail.com>
Cc: linux-mm@kvack.org, linux-pm@vger.kernel.org,
linux-block@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-lvm@lists.linux.dev, lvm-devel@lists.linux.dev,
linux-raid@vger.kernel.org,
DellClientKernel <Dell.Client.Kernel@dell.com>,
dm-devel@lists.linux.dev, linux-btrfs@vger.kernel.org,
"Nhat Pham" <nphamcs@gmail.com>, "Kairui Song" <ryncsn@gmail.com>,
"Pavel Machek" <pavel@ucw.cz>,
"Rodolfo García Peñas" <kix@kix.es>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Eric Biggers" <ebiggers@kernel.org>,
"Lennart Poettering" <mzxreary@0pointer.de>,
"Christian Brauner" <brauner@kernel.org>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Milan Broz" <milan@mazyland.cz>
Subject: [PATCH] pm-hibernate: flush block device cache when hibernating
Date: Fri, 24 Oct 2025 12:23:20 +0200 (CEST) [thread overview]
Message-ID: <03e58462-5045-e12f-9af6-be2aaf19f32c@redhat.com> (raw)
In-Reply-To: <4cd2d217-f97d-4923-b852-4f8746456704@mazyland.cz>
On Fri, 24 Oct 2025, Askar Safin wrote:
> Hi.
>
> Hibernate to swap located on dm-integrity doesn't work.
> Let me first describe why I need this, then I will describe a bug with steps
> to reproduce
> (and some speculation on cause of the bug).
Hi
Does this patch fix it?
Mikulas
From: Mikulas Patocka <mpatocka@redhat.com>
There was reported failure that hibernation doesn't work with
dm-integrity. The reason for the failure is that the hibernation code
doesn't issue the FLUSH bio - the data still sits in the dm-integrity
cache and they are lost when poweroff happens.
This commit fixes the suspend code so that it issues flushes before
writing the header and after writing the header.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Askar Safin <safinaskar@gmail.com>
Link: https://lore.kernel.org/dm-devel/a48a37e3-2c22-44fb-97a4-0e57dc20421a@gmail.com/T/
Cc: stable@vger.kernel.org
---
kernel/power/swap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: linux-2.6/kernel/power/swap.c
===================================================================
--- linux-2.6.orig/kernel/power/swap.c 2025-10-13 21:42:48.000000000 +0200
+++ linux-2.6/kernel/power/swap.c 2025-10-24 12:01:32.000000000 +0200
@@ -320,8 +320,10 @@ static int mark_swapfiles(struct swap_ma
swsusp_header->flags = flags;
if (flags & SF_CRC32_MODE)
swsusp_header->crc32 = handle->crc32;
- error = hib_submit_io_sync(REQ_OP_WRITE | REQ_SYNC,
+ error = hib_submit_io_sync(REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH,
swsusp_resume_block, swsusp_header);
+ if (!error)
+ error = blkdev_issue_flush(file_bdev(hib_resume_bdev_file));
} else {
pr_err("Swap header not found!\n");
error = -ENODEV;
next prev parent reply other threads:[~2025-10-24 10:23 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-23 11:29 dm bug: hibernate to swap located on dm-integrity doesn't work (how to get data redundancy for swap?) Askar Safin
2025-10-23 20:42 ` Milan Broz
2025-10-24 16:31 ` Askar Safin
2025-10-24 17:50 ` Milan Broz
2025-10-25 5:26 ` Askar Safin
2025-10-27 8:08 ` Askar Safin
[not found] ` <4cd2d217-f97d-4923-b852-4f8746456704@mazyland.cz>
2025-10-24 10:23 ` Mikulas Patocka [this message]
2025-10-27 8:42 ` [PATCH] pm-hibernate: flush block device cache when hibernating Askar Safin
2025-10-31 19:29 ` Mikulas Patocka
2025-10-31 19:33 ` [PATCH 1/2] pm-hibernate: flush disk cache when suspending Mikulas Patocka
2025-11-03 15:53 ` Askar Safin
2025-11-22 13:51 ` Milan Broz
2025-11-22 20:33 ` Askar Safin
2025-11-22 22:47 ` Askar Safin
2025-11-24 19:51 ` Mikulas Patocka
2025-10-31 19:35 ` [RFC PATCH 2/2] swsusp: make it possible to hibernate to device mapper devices Mikulas Patocka
2025-11-30 0:56 ` Askar Safin
2025-12-17 23:18 ` Askar Safin
2025-12-22 15:03 ` Milan Broz
2025-12-22 22:24 ` Askar Safin
2025-12-23 1:41 ` Askar Safin
2025-12-23 5:29 ` Askar Safin
2025-12-23 6:33 ` Askar Safin
2026-01-14 7:27 ` Askar Safin
2025-10-29 13:31 ` [PATCH] pm-hibernate: flush block device cache when hibernating Rafael J. Wysocki
2025-10-29 14:38 ` Christoph Hellwig
2025-10-29 16:31 ` Mikulas Patocka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03e58462-5045-e12f-9af6-be2aaf19f32c@redhat.com \
--to=mpatocka@redhat.com \
--cc=Dell.Client.Kernel@dell.com \
--cc=brauner@kernel.org \
--cc=dm-devel@lists.linux.dev \
--cc=ebiggers@kernel.org \
--cc=kix@kix.es \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-lvm@lists.linux.dev \
--cc=linux-mm@kvack.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=lvm-devel@lists.linux.dev \
--cc=milan@mazyland.cz \
--cc=mzxreary@0pointer.de \
--cc=nphamcs@gmail.com \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
--cc=ryncsn@gmail.com \
--cc=safinaskar@gmail.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.