On Wed, Sep 04, 2019 at 07:27:32PM +0300, Max Gurtovoy wrote:
> + if (blk_integrity_rq(req) && req_op(req) == REQ_OP_READ &&
> + error == BLK_STS_OK)
> + t10_pi_complete(req,
> + nr_bytes >> blk_integrity_interval_shift(req->q));
This is not created by your patch, but while reviewing it, I noticed
we're corrupting metadata for TYPE0. Even if there's no in-kernel use
for accessing this data, changing it is still wrong.
Perhaps these t10_pi complete/prepare functions should be part of the
integrity profile like generate_fn/verify_fn.
Or as a quicker fix, we could exclude type0 like below:
---
@@ -246,7 +247,8 @@ void t10_pi_complete(struct request *rq, u8 protection_type,
u32 ref_tag = t10_pi_ref_tag(rq);
struct bio *bio;
- if (protection_type == T10_PI_TYPE3_PROTECTION)
+ if (protection_type == T10_PI_TYPE0_PROTECTION ||
+ protection_type == T10_PI_TYPE3_PROTECTION)
return;
__rq_for_each_bio(bio, rq) {
--
2.14.5