diff mbox series

[v2,1/2] block: ensure correct integrity capability propagation in stacked devices

Message ID 20250226112035.2571-2-anuj20.g@samsung.com
State New
Headers show
Series Fix integrity sysfs reporting inconsistencies | expand

Commit Message

Anuj Gupta Feb. 26, 2025, 11:20 a.m. UTC
queue_limits_stack_integrity() incorrectly sets
BLK_INTEGRITY_DEVICE_CAPABLE for a DM device even when none of its
underlying devices support integrity. This happens because the flag is
inherited from the first base device, even if it lacks integrity support.
This patch ensures that BLK_INTEGRITY_DEVICE_CAPABLE is only inherited if
the first device actually supports integrity.

Reported-by: M Nikhil <nikhilm@linux.ibm.com>
Link: https://lore.kernel.org/linux-block/f6130475-3ccd-45d2-abde-3ccceada0f0a@linux.ibm.com/
Fixes: c6e56cf6b2e7 ("block: move integrity information into queue_limits")
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
 block/blk-settings.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig March 4, 2025, 1:55 p.m. UTC | #1
On Tue, Mar 04, 2025 at 02:18:33PM +0530, Anuj Gupta wrote:
> Christoph,
> Right, based on your comment modified this patch.
> Does this look ok?

Yes, this looks good.
diff mbox series

Patch

diff --git a/block/blk-settings.c b/block/blk-settings.c
index c44dadc35e1e..8bd0d0f1479c 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -861,7 +861,8 @@  bool queue_limits_stack_integrity(struct queue_limits *t,
 
 	if (!ti->tuple_size) {
 		/* inherit the settings from the first underlying device */
-		if (!(ti->flags & BLK_INTEGRITY_STACKED)) {
+		if (!(ti->flags & BLK_INTEGRITY_STACKED) &&
+		    (bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE)) {
 			ti->flags = BLK_INTEGRITY_DEVICE_CAPABLE |
 				(bi->flags & BLK_INTEGRITY_REF_TAG);
 			ti->csum_type = bi->csum_type;