* [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile [not found] <CGME20240704062234epcas5p1dd4ae6e7c91555b9573418d618086c1e@epcas5p1.samsung.com> @ 2024-07-04 6:15 ` Kanchan Joshi 2024-07-04 6:26 ` Christoph Hellwig 2024-07-04 8:06 ` Jens Axboe 0 siblings, 2 replies; 7+ messages in thread From: Kanchan Joshi @ 2024-07-04 6:15 UTC (permalink / raw) To: axboe, hch, martin.petersen; +Cc: linux-block, Anuj Gupta From: Anuj Gupta <anuj20.g@samsung.com> Commit <c6e56cf6b2e7> (block: move integrity information into queue_limits) changed the ref tag calculation logic. It would break if there is no integrity profile. This in turn causes read/write failures for such cases. Fixes: <c6e56cf6b2e7> (block: move integrity information into queue_limits) Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> --- include/linux/t10-pi.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h index 1773610010eb..2c59fe3efcd4 100644 --- a/include/linux/t10-pi.h +++ b/include/linux/t10-pi.h @@ -39,8 +39,11 @@ struct t10_pi_tuple { static inline u32 t10_pi_ref_tag(struct request *rq) { - unsigned int shift = rq->q->limits.integrity.interval_exp; + unsigned int shift = ilog2(queue_logical_block_size(rq->q)); + if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) && + rq->q->limits.integrity.interval_exp) + shift = rq->q->limits.integrity.interval_exp; return blk_rq_pos(rq) >> (shift - SECTOR_SHIFT) & 0xffffffff; } @@ -61,8 +64,11 @@ static inline u64 lower_48_bits(u64 n) static inline u64 ext_pi_ref_tag(struct request *rq) { - unsigned int shift = rq->q->limits.integrity.interval_exp; + unsigned int shift = ilog2(queue_logical_block_size(rq->q)); + if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) && + rq->q->limits.integrity.interval_exp) + shift = rq->q->limits.integrity.interval_exp; return lower_48_bits(blk_rq_pos(rq) >> (shift - SECTOR_SHIFT)); } -- 2.25.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile 2024-07-04 6:15 ` [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile Kanchan Joshi @ 2024-07-04 6:26 ` Christoph Hellwig 2024-07-04 6:32 ` Christoph Hellwig 2024-07-04 8:06 ` Jens Axboe 1 sibling, 1 reply; 7+ messages in thread From: Christoph Hellwig @ 2024-07-04 6:26 UTC (permalink / raw) To: Kanchan Joshi; +Cc: axboe, hch, martin.petersen, linux-block, Anuj Gupta On Thu, Jul 04, 2024 at 11:45:15AM +0530, Kanchan Joshi wrote: > From: Anuj Gupta <anuj20.g@samsung.com> > > Commit <c6e56cf6b2e7> (block: move integrity information into > queue_limits) changed the ref tag calculation logic. It would break if > there is no integrity profile. This in turn causes read/write failures > for such cases. Can you explain the scenario a bit better? I guess this is for when the drivers use PRACT to insert/strip PI because BLK_DEV_INTEGRITY is disabled? > > Fixes: <c6e56cf6b2e7> (block: move integrity information into queue_limits) This is not the standard formatting for fixes tags. > > static inline u32 t10_pi_ref_tag(struct request *rq) > { > - unsigned int shift = rq->q->limits.integrity.interval_exp; > + unsigned int shift = ilog2(queue_logical_block_size(rq->q)); > > + if (IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) && > + rq->q->limits.integrity.interval_exp) > + shift = rq->q->limits.integrity.interval_exp; > return blk_rq_pos(rq) >> (shift - SECTOR_SHIFT) & 0xffffffff; But this only works when the interval_exp equals the block size. So I think the proper fix that not only addresses the regression, but also the long standing buf for larger interval_exp is to make sure interval_exp is always initialized, including for !CONFIG_BLK_DEV_INTEGRITY. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile 2024-07-04 6:26 ` Christoph Hellwig @ 2024-07-04 6:32 ` Christoph Hellwig 2024-07-05 3:49 ` Martin K. Petersen 0 siblings, 1 reply; 7+ messages in thread From: Christoph Hellwig @ 2024-07-04 6:32 UTC (permalink / raw) To: Kanchan Joshi; +Cc: axboe, hch, martin.petersen, linux-block, Anuj Gupta Looking a bit more it seems like never actually merged the SCSI support for an interval_exp smaller than the block size, although I'm pretty sure I've seen Martins patches for it. So i guess we should just go with this patch (preferably with the fixed Fixes tag and a more detailed commit log) and then sort this out later. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile 2024-07-04 6:32 ` Christoph Hellwig @ 2024-07-05 3:49 ` Martin K. Petersen 2024-07-05 5:05 ` Christoph Hellwig 0 siblings, 1 reply; 7+ messages in thread From: Martin K. Petersen @ 2024-07-05 3:49 UTC (permalink / raw) To: Christoph Hellwig Cc: Kanchan Joshi, axboe, martin.petersen, linux-block, Anuj Gupta Christoph, > Looking a bit more it seems like never actually merged the SCSI > support for an interval_exp smaller than the block size, although I'm > pretty sure I've seen Martins patches for it. So i guess we should > just go with this patch (preferably with the fixed Fixes tag and a > more detailed commit log) and then sort this out later. The driver for this feature was being able to use disks with 4Kn sectors and yet provide 8 bytes of PI for every 512 bytes of data for backwards compatibility reasons. I had a couple of drives which supported the feature and several OEMs were requesting it. However, it turned out that using 512e drives was a much more elegant solution to this particular problem. -- Martin K. Petersen Oracle Linux Engineering ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile 2024-07-05 3:49 ` Martin K. Petersen @ 2024-07-05 5:05 ` Christoph Hellwig 2024-07-05 11:21 ` Martin K. Petersen 0 siblings, 1 reply; 7+ messages in thread From: Christoph Hellwig @ 2024-07-05 5:05 UTC (permalink / raw) To: Martin K. Petersen Cc: Christoph Hellwig, Kanchan Joshi, axboe, linux-block, Anuj Gupta On Thu, Jul 04, 2024 at 11:49:56PM -0400, Martin K. Petersen wrote: > I had a couple of drives which supported the feature and several OEMs > were requesting it. However, it turned out that using 512e drives was a > much more elegant solution to this particular problem. So should we just drop the internval_exp member for now? It would simplify things a bit, but more importantly we wouldn't have to fix the !BLK_DEV_INTEGRITY case for strip/insert. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile 2024-07-05 5:05 ` Christoph Hellwig @ 2024-07-05 11:21 ` Martin K. Petersen 0 siblings, 0 replies; 7+ messages in thread From: Martin K. Petersen @ 2024-07-05 11:21 UTC (permalink / raw) To: Christoph Hellwig Cc: Martin K. Petersen, Kanchan Joshi, axboe, linux-block, Anuj Gupta Christoph, > So should we just drop the internval_exp member for now? It would > simplify things a bit, but more importantly we wouldn't have to fix > the !BLK_DEV_INTEGRITY case for strip/insert. Yeah, I think that's fine. 512e won. -- Martin K. Petersen Oracle Linux Engineering ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile 2024-07-04 6:15 ` [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile Kanchan Joshi 2024-07-04 6:26 ` Christoph Hellwig @ 2024-07-04 8:06 ` Jens Axboe 1 sibling, 0 replies; 7+ messages in thread From: Jens Axboe @ 2024-07-04 8:06 UTC (permalink / raw) To: hch, martin.petersen, Kanchan Joshi; +Cc: linux-block, Anuj Gupta On Thu, 04 Jul 2024 11:45:15 +0530, Kanchan Joshi wrote: > Commit <c6e56cf6b2e7> (block: move integrity information into > queue_limits) changed the ref tag calculation logic. It would break if > there is no integrity profile. This in turn causes read/write failures > for such cases. > > Applied, thanks! [1/1] block: t10-pi: Return correct ref tag when queue has no integrity profile commit: 162e06871e6dcde861ef608e0c00a8b6a2d35d43 Best regards, -- Jens Axboe ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-07-05 11:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20240704062234epcas5p1dd4ae6e7c91555b9573418d618086c1e@epcas5p1.samsung.com>
2024-07-04 6:15 ` [PATCH] block: t10-pi: Return correct ref tag when queue has no integrity profile Kanchan Joshi
2024-07-04 6:26 ` Christoph Hellwig
2024-07-04 6:32 ` Christoph Hellwig
2024-07-05 3:49 ` Martin K. Petersen
2024-07-05 5:05 ` Christoph Hellwig
2024-07-05 11:21 ` Martin K. Petersen
2024-07-04 8:06 ` Jens Axboe
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.