mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Akilesh Kailash <akailash@google.com>
To: Mikulas Patocka <mpatocka@redhat.com>,
	Sami Tolvanen <samitolvanen@google.com>
Cc: akailash@google.com, kernel-team@android.com,
	 Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	dm-devel@lists.linux.dev,  linux-kernel@vger.kernel.org
Subject: [PATCH] dm-verity: skip verity_handle_err on I/O errors for metadata
Date: Sat,  8 Feb 2025 23:19:23 +0000	[thread overview]
Message-ID: <20250208231923.1952228-1-akailash@google.com> (raw)

Handle I/O error for metadata blocks if FEC correction fails.
This is similar to handling I/O error for data blocks:
'commit 2c0468e054c0 ("dm verity: skip redundant verity_handle_err()
on I/O errors")'

Fixes: 2c0468e054c0 ("dm verity: skip redundant verity_handle_err()
on I/O errors")
Signed-off-by: Akilesh Kailash <akailash@google.com>
---

Note: This patch should have been included in the data block fix patch.
A "fixes" tag has been added to address this.
Link: https://lore.kernel.org/all/20210913092642.3237796-1-akailash@google.com/
---
 drivers/md/dm-verity-target.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index e86c1431b108..e1ce3b256f0a 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -353,16 +353,26 @@ static int verity_verify_level(struct dm_verity *v, struct dm_verity_io *io,
 		} else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_METADATA,
 					     hash_block, data) == 0)
 			aux->hash_verified = 1;
-		else if (verity_handle_err(v,
+		else {
+			if (bio->bi_status) {
+				/*
+				 * Error correction failed; Just return error
+				 */
+				r = -EIO;
+				goto release_ret_r;
+			}
+			if (verity_handle_err(v,
 					   DM_VERITY_BLOCK_TYPE_METADATA,
 					   hash_block)) {
-			struct bio *bio;
-			io->had_mismatch = true;
-			bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);
-			dm_audit_log_bio(DM_MSG_PREFIX, "verify-metadata", bio,
+				struct bio *bio;
+
+				io->had_mismatch = true;
+				bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);
+				dm_audit_log_bio(DM_MSG_PREFIX, "verify-metadata", bio,
 					 block, 0);
-			r = -EIO;
-			goto release_ret_r;
+				r = -EIO;
+				goto release_ret_r;
+			}
 		}
 	}
 
-- 
2.48.1.502.g6dc24dfdaf-goog


             reply	other threads:[~2025-02-08 23:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-08 23:19 Akilesh Kailash [this message]
2025-02-10 15:02 ` 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=20250208231923.1952228-1-akailash@google.com \
    --to=akailash@google.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --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

all inboxes | Powered by JetHome®