Skip to contentSkip to conversation

fix stacking of PI-capable devices

PATCH New Christoph Hellwig 4 participants 6 messages Aug 18, 2025 Block layer

lore
Share & tools
lore
#0 lore raw

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(-)
#1 lore raw

PATCH 1/2 block: handle pi_tuple_size in queue_limits_stack_integrity

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")
---
 block/blk-settings.c | 3 +++
 1 file changed, 3 insertions(+)
block/blk-settings.c +3 -0
index 07874e9b609f..491c0c48d52b 100644
@@ -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;
Signature · 1 line
2.47.2
#2 lore raw

PATCH 2/2 block: remove newlines from the warnings in blk_validate_integrity_limits

In reply to Christoph Hellwig

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

---
 block/blk-settings.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
block/blk-settings.c +3 -6
index 491c0c48d52b..d6438e6c276d 100644
@@ -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;
Signature · 1 line
2.47.2
maintainer Applied
#5 lore raw
In reply to Christoph Hellwig
Quoted 10 lines · Christoph Hellwig

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,

Signature · 1 line
Jens Axboe