dm-integrity could set discard_granularity lower than the logical block size. This could result in failures when sending discard requests to dm-integrity. This patch fixes discard_granularity. Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx> Reported-by: Eric Wheeler <linux-integrity@xxxxxxxxxxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx --- drivers/md/dm-integrity.c | 1 + 1 file changed, 1 insertion(+) Index: linux-2.6/drivers/md/dm-integrity.c =================================================================== --- linux-2.6.orig/drivers/md/dm-integrity.c 2024-04-16 21:31:36.000000000 +0200 +++ linux-2.6/drivers/md/dm-integrity.c 2024-05-20 16:27:50.000000000 +0200 @@ -3492,6 +3492,7 @@ static void dm_integrity_io_hints(struct limits->physical_block_size = ic->sectors_per_block << SECTOR_SHIFT; blk_limits_io_min(limits, ic->sectors_per_block << SECTOR_SHIFT); limits->dma_alignment = limits->logical_block_size - 1; + limits->discard_granularity = ic->sectors_per_block << SECTOR_SHIFT; } limits->max_integrity_segments = USHRT_MAX; }