From: Eric Biggers <ebiggers@kernel.org>
To: Sami Tolvanen <samitolvanen@google.com>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
Akilesh Kailash <akailash@google.com>,
kernel-team@android.com, Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@kernel.org>,
Milan Broz <gmazyland@gmail.com>,
dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dm-verity: do forward error correction on metadata I/O errors
Date: Mon, 10 Feb 2025 11:05:41 -0800 [thread overview]
Message-ID: <20250210190541.GG1264@sol.localdomain> (raw)
In-Reply-To: <CABCJKucmOTVF1jY3vM7VKHuLkDeUxK1EU7YK=C+vgfWvgZFWPQ@mail.gmail.com>
On Mon, Feb 10, 2025 at 08:57:55AM -0800, Sami Tolvanen wrote:
> Hi Mikulas,
>
> On Mon, Feb 10, 2025 at 7:04 AM Mikulas Patocka <mpatocka@redhat.com> wrote:
> >
> > Do forward error correction if metadata I/O fails.
> >
> > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> >
> > ---
> > drivers/md/dm-verity-target.c | 19 +++++++++++++++++--
> > 1 file changed, 17 insertions(+), 2 deletions(-)
> >
> > Index: linux-2.6/drivers/md/dm-verity-target.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/md/dm-verity-target.c 2025-02-04 13:52:45.000000000 +0100
> > +++ linux-2.6/drivers/md/dm-verity-target.c 2025-02-10 15:55:42.000000000 +0100
> > @@ -324,8 +324,22 @@ static int verity_verify_level(struct dm
> > &buf, bio->bi_ioprio);
> > }
> >
> > - if (IS_ERR(data))
> > - return PTR_ERR(data);
> > + if (IS_ERR(data)) {
> > + r = PTR_ERR(data);
> > + data = dm_bufio_new(v->bufio, hash_block, &buf);
> > + if (IS_ERR(data))
> > + return r;
> > + if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_METADATA,
> > + hash_block, data) == 0) {
> > + aux = dm_bufio_get_aux_data(buf);
> > + aux->hash_verified = 1;
> > + goto release_ok;
> > + } else {
> > + dm_bufio_release(buf);
> > + dm_bufio_forget(v->bufio, hash_block);
> > + return r;
> > + }
> > + }
>
> Don't we still have to check for io->in_bh before trying to correct the error?
>
> Overall, it would be nice not to duplicate code here. Should the
> metadata error correction / handling be moved to a separate function
> similar to verity_handle_data_hash_mismatch?
>
It's also incorrect to do this when skip_verified=true, since in that case
want_digest (which verity_fec_decode() uses) has not been initialized yet.
- Eric
next prev parent reply other threads:[~2025-02-10 19:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 15:04 [PATCH] dm-verity: do forward error correction on metadata I/O errors Mikulas Patocka
2025-02-10 16:39 ` Milan Broz
2025-02-10 16:46 ` [PATCH v2] " Mikulas Patocka
2025-02-10 16:57 ` [PATCH] " Sami Tolvanen
2025-02-10 19:05 ` Eric Biggers [this message]
2025-02-17 21:35 ` 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=20250210190541.GG1264@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=agk@redhat.com \
--cc=akailash@google.com \
--cc=dm-devel@lists.linux.dev \
--cc=gmazyland@gmail.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=samitolvanen@google.com \
--cc=snitzer@kernel.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