All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] dm-integrity: fix mismatched queue limits
@ 2026-03-25 19:36 Keith Busch
  2026-03-25 19:36 ` [PATCH 2/3] dm-integrity: always set the io hints Keith Busch
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Keith Busch @ 2026-03-25 19:36 UTC (permalink / raw)
  To: dm-devel; +Cc: mpatocka, snitzer, Keith Busch

From: Keith Busch <kbusch@kernel.org>

A user can integritysetup a device with a backing device using a 4k
logical block size, but request the dm device use 1k or 2k. This
mismatch creates an inconsistency such that the dm device would report
limits for IO that it can't actually execute. Fix this by using the
backing device's limits if they are larger.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/md/dm-integrity.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
index 06e805902151c..8dfd498ed1ffd 100644
--- a/drivers/md/dm-integrity.c
+++ b/drivers/md/dm-integrity.c
@@ -4047,9 +4047,15 @@ static void dm_integrity_io_hints(struct dm_target *ti, struct queue_limits *lim
 	struct dm_integrity_c *ic = ti->private;
 
 	if (ic->sectors_per_block > 1) {
-		limits->logical_block_size = ic->sectors_per_block << SECTOR_SHIFT;
-		limits->physical_block_size = ic->sectors_per_block << SECTOR_SHIFT;
-		limits->io_min = ic->sectors_per_block << SECTOR_SHIFT;
+		limits->logical_block_size =
+				max(limits->logical_block_size,
+				    ic->sectors_per_block << SECTOR_SHIFT);
+		limits->physical_block_size =
+				max(limits->physical_block_size,
+				    ic->sectors_per_block << SECTOR_SHIFT);
+		limits->io_min =
+				max(limits->io_min,
+				    ic->sectors_per_block << SECTOR_SHIFT);
 		limits->dma_alignment = limits->logical_block_size - 1;
 		limits->discard_granularity = ic->sectors_per_block << SECTOR_SHIFT;
 	}
-- 
2.52.0


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

end of thread, other threads:[~2026-03-30 18:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 19:36 [PATCH 1/3] dm-integrity: fix mismatched queue limits Keith Busch
2026-03-25 19:36 ` [PATCH 2/3] dm-integrity: always set the io hints Keith Busch
2026-03-25 19:36 ` [PATCH 3/3] dm: provide helper to set stacked limits Keith Busch
2026-03-27 19:41 ` [PATCH 1/3] dm-integrity: fix mismatched queue limits Benjamin Marzinski
2026-03-27 20:36   ` Keith Busch
2026-03-30 17:41     ` Benjamin Marzinski
2026-03-30 18:16       ` Keith Busch
2026-03-27 21:25 ` Mikulas Patocka

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.