Commit 7b24fc4d authored by Martin K. Petersen's avatar Martin K. Petersen Committed by Jens Axboe

block: Don't verify integrity metadata on read error

If we get an I/O error on a read request there is no point in doing a
verify pass on the integrity buffer.  Adjust the completion path
accordingly.
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent f2257b70
...@@ -465,7 +465,7 @@ static int bio_integrity_verify(struct bio *bio) ...@@ -465,7 +465,7 @@ static int bio_integrity_verify(struct bio *bio)
if (ret) { if (ret) {
kunmap_atomic(kaddr, KM_USER0); kunmap_atomic(kaddr, KM_USER0);
break; return ret;
} }
sectors = bv->bv_len / bi->sector_size; sectors = bv->bv_len / bi->sector_size;
...@@ -493,18 +493,13 @@ static void bio_integrity_verify_fn(struct work_struct *work) ...@@ -493,18 +493,13 @@ static void bio_integrity_verify_fn(struct work_struct *work)
struct bio_integrity_payload *bip = struct bio_integrity_payload *bip =
container_of(work, struct bio_integrity_payload, bip_work); container_of(work, struct bio_integrity_payload, bip_work);
struct bio *bio = bip->bip_bio; struct bio *bio = bip->bip_bio;
int error = bip->bip_error; int error;
if (bio_integrity_verify(bio)) { error = bio_integrity_verify(bio);
clear_bit(BIO_UPTODATE, &bio->bi_flags);
error = -EIO;
}
/* Restore original bio completion handler */ /* Restore original bio completion handler */
bio->bi_end_io = bip->bip_end_io; bio->bi_end_io = bip->bip_end_io;
bio_endio(bio, error);
if (bio->bi_end_io)
bio->bi_end_io(bio, error);
} }
/** /**
...@@ -525,7 +520,17 @@ void bio_integrity_endio(struct bio *bio, int error) ...@@ -525,7 +520,17 @@ void bio_integrity_endio(struct bio *bio, int error)
BUG_ON(bip->bip_bio != bio); BUG_ON(bip->bip_bio != bio);
bip->bip_error = error; /* In case of an I/O error there is no point in verifying the
* integrity metadata. Restore original bio end_io handler
* and run it.
*/
if (error) {
bio->bi_end_io = bip->bip_end_io;
bio_endio(bio, error);
return;
}
INIT_WORK(&bip->bip_work, bio_integrity_verify_fn); INIT_WORK(&bip->bip_work, bio_integrity_verify_fn);
queue_work(kintegrityd_wq, &bip->bip_work); queue_work(kintegrityd_wq, &bip->bip_work);
} }
......
...@@ -312,7 +312,6 @@ struct bio_integrity_payload { ...@@ -312,7 +312,6 @@ struct bio_integrity_payload {
void *bip_buf; /* generated integrity data */ void *bip_buf; /* generated integrity data */
bio_end_io_t *bip_end_io; /* saved I/O completion fn */ bio_end_io_t *bip_end_io; /* saved I/O completion fn */
int bip_error; /* saved I/O error */
unsigned int bip_size; unsigned int bip_size;
unsigned short bip_pool; /* pool the ivec came from */ unsigned short bip_pool; /* pool the ivec came from */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment