Skip to content
Snippets Groups Projects
Commit 60a89a3c authored by Martin K. Petersen's avatar Martin K. Petersen
Browse files

scsi: t10-pi: Return correct ref tag when queue has no integrity profile


Commit ddd0bc75 ("block: move ref_tag calculation func to the block
layer") moved ref tag calculation from SCSI to a library function. However,
this change broke returning the correct ref tag for devices operating in
DIF mode since these do not have an associated block integrity profile.
This in turn caused read/write failures on PI-formatted disks attached to
an mpt3sas controller.

Fixes: ddd0bc75 ("block: move ref_tag calculation func to the block layer")
Cc: stable@vger.kernel.org # 4.19+
Reported-by: default avatarJohn Garry <john.garry@huawei.com>
Tested-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 9ae4f842
No related branches found
No related tags found
No related merge requests found
...@@ -39,12 +39,13 @@ struct t10_pi_tuple { ...@@ -39,12 +39,13 @@ struct t10_pi_tuple {
static inline u32 t10_pi_ref_tag(struct request *rq) static inline u32 t10_pi_ref_tag(struct request *rq)
{ {
unsigned int shift = ilog2(queue_logical_block_size(rq->q));
#ifdef CONFIG_BLK_DEV_INTEGRITY #ifdef CONFIG_BLK_DEV_INTEGRITY
return blk_rq_pos(rq) >> if (rq->q->integrity.interval_exp)
(rq->q->integrity.interval_exp - 9) & 0xffffffff; shift = rq->q->integrity.interval_exp;
#else
return -1U;
#endif #endif
return blk_rq_pos(rq) >> (shift - SECTOR_SHIFT) & 0xffffffff;
} }
extern const struct blk_integrity_profile t10_pi_type1_crc; extern const struct blk_integrity_profile t10_pi_type1_crc;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment