This is a note to let you know that I've just added the patch titled sd: also set max_user_sectors when setting max_sectors to the 6.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: sd-also-set-max_user_sectors-when-setting-max_sector.patch and it can be found in the queue-6.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 7a49f90b77513ee926ee9762ebe7f01ef8acc1d9 Author: Christoph Hellwig <hch@xxxxxx> Date: Thu May 23 20:26:13 2024 +0200 sd: also set max_user_sectors when setting max_sectors [ Upstream commit bafea1c58b24be594d97841ced1b7ae0347bf6e3 ] sd can set a max_sectors value that is lower than the max_hw_sectors limit based on the block limits VPD page. While this is rather unusual, it used to work until the max_user_sectors field was split out to cleanly deal with conflicting hardware and user limits when the hardware limit changes. Also set max_user_sectors to ensure the limit can properly be stacked. Fixes: 4f563a64732d ("block: add a max_user_discard_sectors queue limit") Reported-by: Mike Snitzer <snitzer@xxxxxxxxxx> Signed-off-by: Christoph Hellwig <hch@xxxxxx> Acked-by: Mike Snitzer <snitzer@xxxxxxxxxx> Reviewed-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Link: https://lore.kernel.org/r/20240523182618.602003-2-hch@xxxxxx Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 65cdc8b77e358..caac482fff2ff 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3707,8 +3707,10 @@ static int sd_revalidate_disk(struct gendisk *disk) */ if (sdkp->first_scan || q->limits.max_sectors > q->limits.max_dev_sectors || - q->limits.max_sectors > q->limits.max_hw_sectors) + q->limits.max_sectors > q->limits.max_hw_sectors) { q->limits.max_sectors = rw_max; + q->limits.max_user_sectors = rw_max; + } sdkp->first_scan = 0;