From: Askar Safin <safinaskar@gmail.com>
To: gmazyland@gmail.com
Cc: Dell.Client.Kernel@dell.com, brauner@kernel.org,
dm-devel@lists.linux.dev, ebiggers@kernel.org, kix@kix.es,
linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org,
linux-crypto@vger.kernel.org, linux-lvm@lists.linux.dev,
linux-mm@kvack.org, linux-pm@vger.kernel.org,
linux-raid@vger.kernel.org, lvm-devel@lists.linux.dev,
mzxreary@0pointer.de, nphamcs@gmail.com, pavel@ucw.cz,
rafael@kernel.org, ryncsn@gmail.com, safinaskar@gmail.com,
torvalds@linux-foundation.org
Subject: Re: dm bug: hibernate to swap located on dm-integrity doesn't work (how to get data redundancy for swap?)
Date: Mon, 27 Oct 2025 11:08:56 +0300 [thread overview]
Message-ID: <20251027080856.2053794-1-safinaskar@gmail.com> (raw)
In-Reply-To: <a48a37e3-2c22-44fb-97a4-0e57dc20421a@gmail.com>
Milan Broz <gmazyland@gmail.com>:
> Hi,
That patch doesn't fix the problem. I will send more details within some
days, hopefully today.
Also, I just found that for reliable reproduction you need to do
"swapoff /dev/mapper/swap; cat /dev/mapper/swap > /dev/null" after resume
(assuming you were able to resume, of course).
So here is updated script for reproduction in Qemu:
https://zerobin.net/?0aa379bae218cf92#DDVFMvfi6S3ydCQLSrL+us1lHjXQJIZasW55JI7gEfU=
This script is very easy to use!
Try 1-2 times to reproduce.
Here is result of that script:
https://zerobin.net/?3d9447900052f9ce#ng0htJDAdSsvqVunL+BnoLHXszM6ardt9R3wkbO9L28=
This results are on 43e9ad0c55a3, which is current master, without Mikulas Patocka's
patch, but with this Mario's patch:
https://lore.kernel.org/linux-pm/20251026033115.436448-1-superm1@kernel.org/ .
Mario's patch is needed, otherwise we get WARNING when we try to hibernate.
Again: these logs are without Mikulas Patocka's patch. I will send results
of testing his patch later, hopefully today. But don't expect much. As I said,
his patch doesn't work.
"log-def-1" is output of first Qemu invocation (i. e. first boot) with
default integritysetup options. "log-def-2" is second Qemu invocation
(i. e. when we try to resume).
log-bit-{1,2} is same thing, but with "--integrity-bitmap-mode" added to
"integritysetup format" and "integritysetup open".
log-no-{1,2} is same, but with "--integrity-no-journal".
log-nodm-{1,2} is same, but without dm-integrity at all, i. e. we create
swap directly on partition.
As you can see in logs, hibernate with dm-integrity never works perfectly.
We either unable to resume, either we are able to resume, but then get
integrity errors when we do "cat /dev/mapper/swap > /dev/null".
Swap directly on partition works.
Again: you may need 1-2 attempts to reproduce using this script.
Also: the bug is reproducible even if we do "echo test_resume > /sys/power/disk".
> Are you sure you used --integrity-no-journal both in activation before
> hibernation and also in resume? If not, please try it.
I'm totally sure. (You can see script above and "set -x" output in logs.)
> You can verify it with "integritysetup status <device>" - it should say "journal: not active".
I just checked. It indeed says so.
> And if it does not work, could you try to use -integrity-recovery-mode the same
> way (both before hibernation and later in resume)? This will effectively ignore checksums
So I should pass it to both "integritysetup open" invocations, but
not to "integritysetup format" invocation. Right? Okay, I did so.
I. e. I did this:
integritysetup format --batch-mode --integrity xxhash64 /dev/sda # when formatting
integritysetup open --integrity-recovery-mode --integrity xxhash64 /dev/sda swap # before hibernate
integritysetup open --integrity-recovery-mode --integrity xxhash64 /dev/sda early-swap # when resuming
And something completely unexpected happened!
"swapon" failed immediately after "mkswap"!!! I. e. "swapon" was
unable to read swap signature right after "mkswap".
Here is log:
https://zerobin.net/?ebe34fc9ce94be45#6DWKSXvgUDKIrF4299th0ylhQNEcdqeeBfxzSJjROpA=
This seems like another dm-integrity bug.
> You can verify it with "integritysetup status <device>" - it should say "mode: read/write recovery".
Yes, it says so in logs above.
> You can also try to decrease journal commit time with --journal-commit-time option,
I just put "--journal-commit-time 1" to format and both opens. I got the same
result I get with default options: i. e. blkid returns "swap" instead of
"swsuspend", when I try to resume. Here are logs:
https://zerobin.net/?c5f8320eb89b1cfb#drrxRgnGk817oEDUA8idhn+WEQgocWjtbsAYuEHF5rI= .
> Redundancy? You mean data integrity protection? There is no redundancy, only additional authentication tag
> (detecting integrity error but not correcting it).
Yes, I meant integrity protection.
--
Askar Safin
next prev parent reply other threads:[~2025-10-27 8:09 UTC|newest]
Thread overview: 15+ 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 [this message]
[not found] ` <4cd2d217-f97d-4923-b852-4f8746456704@mazyland.cz>
2025-10-24 10:23 ` [PATCH] pm-hibernate: flush block device cache when hibernating Mikulas Patocka
2025-10-27 8:42 ` 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-10-31 19:35 ` [RFC PATCH 2/2] swsusp: make it possible to hibernate to device mapper devices Mikulas Patocka
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=20251027080856.2053794-1-safinaskar@gmail.com \
--to=safinaskar@gmail.com \
--cc=Dell.Client.Kernel@dell.com \
--cc=brauner@kernel.org \
--cc=dm-devel@lists.linux.dev \
--cc=ebiggers@kernel.org \
--cc=gmazyland@gmail.com \
--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=mzxreary@0pointer.de \
--cc=nphamcs@gmail.com \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
--cc=ryncsn@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).