linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fix stacking of PI-capable devices
@ 2025-08-18  4:54 Christoph Hellwig
  2025-08-18  4:54 ` [PATCH 1/2] block: handle pi_tuple_size in queue_limits_stack_integrity Christoph Hellwig
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-08-18  4:54 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Martin K. Petersen, Anuj Gupta, linux-block

Hi all,

this series fixes stacking devices such as DM on top of PI-capable
devices by adding support for the new pi_tuple_size field to the
stacking helper.  It also makes the error message when this goes wrong
more readable.

Diffstat:
 blk-settings.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] block: handle pi_tuple_size in queue_limits_stack_integrity
  2025-08-18  4:54 fix stacking of PI-capable devices Christoph Hellwig
@ 2025-08-18  4:54 ` Christoph Hellwig
  2025-08-18  4:54 ` [PATCH 2/2] block: remove newlines from the warnings in blk_validate_integrity_limits Christoph Hellwig
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-08-18  4:54 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Martin K. Petersen, Anuj Gupta, linux-block

queue_limits_stack_integrity needs to handle the new pi_tuple_size field,
otherwise stacking PI-capable devices will always fail.

Fixes: 76e45252a4ce ("block: introduce pi_tuple_size field in blk_integrity")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-settings.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 07874e9b609f..491c0c48d52b 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -972,6 +972,8 @@ bool queue_limits_stack_integrity(struct queue_limits *t,
 			goto incompatible;
 		if (ti->csum_type != bi->csum_type)
 			goto incompatible;
+		if (ti->pi_tuple_size != bi->pi_tuple_size)
+			goto incompatible;
 		if ((ti->flags & BLK_INTEGRITY_REF_TAG) !=
 		    (bi->flags & BLK_INTEGRITY_REF_TAG))
 			goto incompatible;
@@ -980,6 +982,7 @@ bool queue_limits_stack_integrity(struct queue_limits *t,
 		ti->flags |= (bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE) |
 			     (bi->flags & BLK_INTEGRITY_REF_TAG);
 		ti->csum_type = bi->csum_type;
+		ti->pi_tuple_size = bi->pi_tuple_size;
 		ti->metadata_size = bi->metadata_size;
 		ti->pi_offset = bi->pi_offset;
 		ti->interval_exp = bi->interval_exp;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] block: remove newlines from the warnings in blk_validate_integrity_limits
  2025-08-18  4:54 fix stacking of PI-capable devices Christoph Hellwig
  2025-08-18  4:54 ` [PATCH 1/2] block: handle pi_tuple_size in queue_limits_stack_integrity Christoph Hellwig
@ 2025-08-18  4:54 ` Christoph Hellwig
  2025-08-18 15:53 ` fix stacking of PI-capable devices Martin K. Petersen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-08-18  4:54 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Martin K. Petersen, Anuj Gupta, linux-block

Otherwise they are very hard to read in the kernel log.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-settings.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 491c0c48d52b..d6438e6c276d 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -157,16 +157,14 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
 	switch (bi->csum_type) {
 	case BLK_INTEGRITY_CSUM_NONE:
 		if (bi->pi_tuple_size) {
-			pr_warn("pi_tuple_size must be 0 when checksum type \
-				 is none\n");
+			pr_warn("pi_tuple_size must be 0 when checksum type is none\n");
 			return -EINVAL;
 		}
 		break;
 	case BLK_INTEGRITY_CSUM_CRC:
 	case BLK_INTEGRITY_CSUM_IP:
 		if (bi->pi_tuple_size != sizeof(struct t10_pi_tuple)) {
-			pr_warn("pi_tuple_size mismatch for T10 PI: expected \
-				 %zu, got %u\n",
+			pr_warn("pi_tuple_size mismatch for T10 PI: expected %zu, got %u\n",
 				 sizeof(struct t10_pi_tuple),
 				 bi->pi_tuple_size);
 			return -EINVAL;
@@ -174,8 +172,7 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
 		break;
 	case BLK_INTEGRITY_CSUM_CRC64:
 		if (bi->pi_tuple_size != sizeof(struct crc64_pi_tuple)) {
-			pr_warn("pi_tuple_size mismatch for CRC64 PI: \
-				 expected %zu, got %u\n",
+			pr_warn("pi_tuple_size mismatch for CRC64 PI: expected %zu, got %u\n",
 				 sizeof(struct crc64_pi_tuple),
 				 bi->pi_tuple_size);
 			return -EINVAL;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: fix stacking of PI-capable devices
  2025-08-18  4:54 fix stacking of PI-capable devices Christoph Hellwig
  2025-08-18  4:54 ` [PATCH 1/2] block: handle pi_tuple_size in queue_limits_stack_integrity Christoph Hellwig
  2025-08-18  4:54 ` [PATCH 2/2] block: remove newlines from the warnings in blk_validate_integrity_limits Christoph Hellwig
@ 2025-08-18 15:53 ` Martin K. Petersen
  2025-08-18 15:58 ` Anuj gupta
  2025-08-18 17:18 ` Jens Axboe
  4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2025-08-18 15:53 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jens Axboe, Martin K. Petersen, Anuj Gupta, linux-block


Christoph,

> this series fixes stacking devices such as DM on top of PI-capable
> devices by adding support for the new pi_tuple_size field to the
> stacking helper. It also makes the error message when this goes wrong
> more readable.

Looks good to me.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: fix stacking of PI-capable devices
  2025-08-18  4:54 fix stacking of PI-capable devices Christoph Hellwig
                   ` (2 preceding siblings ...)
  2025-08-18 15:53 ` fix stacking of PI-capable devices Martin K. Petersen
@ 2025-08-18 15:58 ` Anuj gupta
  2025-08-18 17:18 ` Jens Axboe
  4 siblings, 0 replies; 6+ messages in thread
From: Anuj gupta @ 2025-08-18 15:58 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jens Axboe, Martin K. Petersen, Anuj Gupta, linux-block

Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: fix stacking of PI-capable devices
  2025-08-18  4:54 fix stacking of PI-capable devices Christoph Hellwig
                   ` (3 preceding siblings ...)
  2025-08-18 15:58 ` Anuj gupta
@ 2025-08-18 17:18 ` Jens Axboe
  4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2025-08-18 17:18 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Martin K. Petersen, Anuj Gupta, linux-block


On Mon, 18 Aug 2025 06:54:49 +0200, Christoph Hellwig wrote:
> this series fixes stacking devices such as DM on top of PI-capable
> devices by adding support for the new pi_tuple_size field to the
> stacking helper.  It also makes the error message when this goes wrong
> more readable.
> 
> Diffstat:
>  blk-settings.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> [...]

Applied, thanks!

[1/2] block: handle pi_tuple_size in queue_limits_stack_integrity
      commit: 61ca3b891b4b9667334c1356a73f28954c92d43a
[2/2] block: remove newlines from the warnings in blk_validate_integrity_limits
      commit: f4ae1744033d54b63c31a3664a4fdf5cebec7f27

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-18 17:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18  4:54 fix stacking of PI-capable devices Christoph Hellwig
2025-08-18  4:54 ` [PATCH 1/2] block: handle pi_tuple_size in queue_limits_stack_integrity Christoph Hellwig
2025-08-18  4:54 ` [PATCH 2/2] block: remove newlines from the warnings in blk_validate_integrity_limits Christoph Hellwig
2025-08-18 15:53 ` fix stacking of PI-capable devices Martin K. Petersen
2025-08-18 15:58 ` Anuj gupta
2025-08-18 17:18 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).