On Fri, Oct 24, 2025 at 12:23 PM Mikulas Patocka <[email protected]> wrote: > > > > 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 <[email protected]> > > 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.
Hmm, shouldn't it flush every time it does a sync write, and not just in these two cases? > > Signed-off-by: Mikulas Patocka <[email protected]> > Reported-by: Askar Safin <[email protected]> > Link: > https://lore.kernel.org/dm-devel/[email protected]/T/ > Cc: [email protected] > > --- > 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; >
