dm-verity: skip verity_handle_err on I/O errors for metadata
PATCH 1/1 dm-verity: skip verity_handle_err on I/O errors for metadata
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")'
on I/O errors")
---
Note: This patch should have been included in the data block fix patch. A "fixes" tag has been added to address this.
--- drivers/md/dm-verity-target.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/md/dm-verity-target.c +17 -7
@@ -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; + } } }
Signature · 1 line
2.48.1.502.g6dc24dfdaf-goog
Mikulas Patocka
maintainerHi
This doesn't seem correct - bio->bi_status is not set at a place where you are testing it.
If metadata I/O fails, the code goes down this branch "if (IS_ERR(data)) return PTR_ERR(data);" in verity_verify_level - i.e. it doesn't reach the piece that your patch is modifying.
I am sending a next patch (untested) that does forward error correction for metadata I/O failures.
Mikulas
Quoted 58 lines · Akilesh Kailash
Handle I/O error for metadata blocks if FEC correction fails. This is similar to handling I/O error for data blocks:
'commit2c0468e054c0("dm verity: skip redundantverity_handle_err()on I/O errors")'Fixes 2c0468e054c0 ("dm verity: skip redundant verity_handle_err()on I/O errors")
Signed-off-by Akilesh Kailash <[email protected]>---
Note: This patch should have been included in the data block fix patch. A "fixes" tag has been added to address this.
--- drivers/md/dm-verity-target.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)drivers/md/dm-verity-target.c +17
-7@@ -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; + } } }Signature · 1 line
2.48.1.502.g6dc24dfdaf-goog