block: cap atomic write size by PI buffer size constraints

As Sashiko points out, limiting the I/O size by the size of the available
PI buffer can cause inconsistencies for atomic writes.  This also limit
atomic_write_max_sectors in blk_validate_integrity_limits.

Fixes: ec7f31b2a2 ("block: make bio auto-integrity deadlock safe")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <mkp@kernel.org>
Link: https://patch.msgid.link/20260907074111.721054-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2026-09-07 10:40:53 +03:00 committed by Jens Axboe
parent d952f6acb7
commit 1418b5633c

View File

@ -206,6 +206,12 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
lim->max_sectors = min(lim->max_sectors,
max_integrity_io_size(lim) >> SECTOR_SHIFT);
if (lim->features & BLK_FEAT_ATOMIC_WRITES) {
lim->atomic_write_max_sectors =
min(lim->atomic_write_max_sectors,
max_integrity_io_size(lim) >> SECTOR_SHIFT);
}
return 0;
}