From: Eric Biggers <ebiggers@kernel.org>
To: "周伟江 (Weijiang Zhou)" <weijiang.zhou@unisoc.com>
Cc: "dm-devel@lists.linux.dev" <dm-devel@lists.linux.dev>,
"Alasdair Kergon" <agk@redhat.com>,
"Mike Snitzer" <snitzer@kernel.org>,
"Mikulas Patocka" <mpatocka@redhat.com>,
"Benjamin Marzinski" <bmarzins@redhat.com>,
"Sami Tolvanen" <samitolvanen@google.com>,
"金红宇 (Hongyu Jin)" <hongyu.jin@unisoc.com>,
"吴祥禄 (Xianglu Wu)" <Xianglu.Wu@unisoc.com>,
"吴周镜 (Justin Wu)" <Justin.Wu@unisoc.com>
Subject: Re: [RFC PATCH 2/2] dm-verity: don't restart or panic on errors during system shutdown
Date: Thu, 12 Nov 2026 21:55:23 -0800 [thread overview]
Message-ID: <20261113055523.GB76778@sol> (raw)
In-Reply-To: <9cc9b5c7460d4b0db002e7954b2eb893@zeshmbx08.spreadtrum.com>
On Tue, Nov 10, 2026 at 01:06:21PM +0000, 周伟江 (Weijiang Zhou) wrote:
> Commit 252bd1256396 ("dm verity: skip verity work if I/O error when system
> is shutting down") stopped I/O errors during shutdown from triggering a
> restart, since devices may legitimately be gone by then. Errors that reach
> verity_handle_err(), e.g. through a failed hash block read followed by a
> failed FEC attempt, are not covered and still call kernel_restart() or
> panic().
>
> During a reboot that is both wrong (nothing is corrupt) and harmful: it
> races with the reboot already in progress and replaces its reason with
> "dm-verity device corrupted", which bootloaders such as Android's treat as
> a verity failure and switch the device to EIO mode.
>
> Apply the same shutdown check in verity_handle_err(). Corruption is still
> logged, recorded in hash_failed and reported via uevent, and the I/O still
> fails.
verity_handle_err() is supposed to be called only on corruption. Just
as established by patch 1, there is a bug where an I/O error is
unnecessarily escalated to corruption.
This patch might still be worthwhile, to be robust against hypothetical
storage devices that return successful reads with incorrect data while
the system is shutting down. Just the commit message and comments don't
really match up with that.
>+/*
>+ * Skip verity work in response to I/O error when system is shutting down.
>+ */
>+static inline bool verity_is_system_shutting_down(void)
>+{
>+return system_state == SYSTEM_HALT || system_state == SYSTEM_POWER_OFF
>+|| system_state == SYSTEM_RESTART;
>+}
The above comment is misleading. This patch makes this function be
called by verity_handle_err() which is for handling corruption. It also
occurs *during* the verity work.
> +/*
> + * Devices may already be quiesced (e.g. UFS set offline by its
> + * shutdown hook), so a failure here does not imply corruption. Fail
> + * the I/O but do not restart or panic, which would also override the
> + * reboot reason of the shutdown already in progress.
> + */
> +if (verity_is_system_shutting_down())
> +return 1;
Shouldn't this go earlier in the function? By the time we get here,
verity_handle_err() has already recorded the corruption in struct
dm_verity (where DM_TABLE_STATUS can read it) and sent a uevent to
userspace notifying them of the corruption. That isn't very consistent
with the idea that if verity_is_system_shutting_down() then corruption
is not reliable and should not be reported.
Side note: as Mikulas mentioned, your patches were also corrupted and do
not apply. You also should not include email footers telling people to
delete your emails, as they may do what you ask.
- Eric
prev parent reply other threads:[~2026-11-13 5:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 13:06 [RFC PATCH 0/2] dm-verity: don't let FEC decode into a dm_bufio page that is already in the cache 周伟江 (Weijiang Zhou)
2026-11-10 13:06 ` [RFC PATCH 1/2] dm-verity: don't decode FEC " 周伟江 (Weijiang Zhou)
2026-11-10 21:08 ` Mikulas Patocka
2026-11-11 3:14 ` 周伟江 (Weijiang Zhou)
2026-11-11 23:33 ` Mikulas Patocka
2026-11-12 0:38 ` Sami Tolvanen
2026-11-13 5:36 ` Eric Biggers
2026-11-10 13:06 ` [RFC PATCH 2/2] dm-verity: don't restart or panic on errors during system shutdown 周伟江 (Weijiang Zhou)
2026-11-10 21:13 ` Mikulas Patocka
2026-11-11 3:14 ` 周伟江 (Weijiang Zhou)
2026-11-11 22:48 ` Mikulas Patocka
2026-11-13 5:55 ` Eric Biggers [this message]
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=20261113055523.GB76778@sol \
--to=ebiggers@kernel.org \
--cc=Justin.Wu@unisoc.com \
--cc=Xianglu.Wu@unisoc.com \
--cc=agk@redhat.com \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=hongyu.jin@unisoc.com \
--cc=mpatocka@redhat.com \
--cc=samitolvanen@google.com \
--cc=snitzer@kernel.org \
--cc=weijiang.zhou@unisoc.com \
/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.