Skip to content

Commit 2c0468e

Browse files
Akilesh Kailashsnitm
authored andcommitted
dm verity: skip redundant verity_handle_err() on I/O errors
Without FEC, dm-verity won't call verity_handle_err() when I/O fails, but with FEC enabled, it currently does even if an I/O error has occurred. If there is an I/O error and FEC correction fails, return the error instead of calling verity_handle_err() again. Suggested-by: Sami Tolvanen <[email protected]> Signed-off-by: Akilesh Kailash <[email protected]> Reviewed-by: Sami Tolvanen <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 64570fb commit 2c0468e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

drivers/md/dm-verity-target.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ static int verity_verify_io(struct dm_verity_io *io)
475475
struct bvec_iter start;
476476
unsigned b;
477477
struct crypto_wait wait;
478+
struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);
478479

479480
for (b = 0; b < io->n_blocks; b++) {
480481
int r;
@@ -529,9 +530,17 @@ static int verity_verify_io(struct dm_verity_io *io)
529530
else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_DATA,
530531
cur_block, NULL, &start) == 0)
531532
continue;
532-
else if (verity_handle_err(v, DM_VERITY_BLOCK_TYPE_DATA,
533-
cur_block))
534-
return -EIO;
533+
else {
534+
if (bio->bi_status) {
535+
/*
536+
* Error correction failed; Just return error
537+
*/
538+
return -EIO;
539+
}
540+
if (verity_handle_err(v, DM_VERITY_BLOCK_TYPE_DATA,
541+
cur_block))
542+
return -EIO;
543+
}
535544
}
536545

537546
return 0;

0 commit comments

Comments
 (0)