Message ID | d015c396-d686-48b1-1460-c8e1b18f4c4c@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | dm-integrity: set discard_granularity to logical block size | expand |
On Mon, May 20, 2024 at 04:48:31PM +0200, Mikulas Patocka wrote: > 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. What kernel was this reported on? For current mainline, blk_validate_limits should ensure that the discard_granularity is floored by the logical block size.
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; }
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@redhat.com> Reported-by: Eric Wheeler <linux-integrity@lists.ewheeler.net> Cc: stable@vger.kernel.org --- drivers/md/dm-integrity.c | 1 + 1 file changed, 1 insertion(+)