Skip to content

Commit bafea1c

Browse files
Christoph Hellwigaxboe
authored andcommitted
sd: also set max_user_sectors when setting max_sectors
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: 4f563a6 ("block: add a max_user_discard_sectors queue limit") Reported-by: Mike Snitzer <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Acked-by: Mike Snitzer <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 233e27b commit bafea1c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/scsi/sd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3700,8 +3700,10 @@ static int sd_revalidate_disk(struct gendisk *disk)
37003700
*/
37013701
if (sdkp->first_scan ||
37023702
q->limits.max_sectors > q->limits.max_dev_sectors ||
3703-
q->limits.max_sectors > q->limits.max_hw_sectors)
3703+
q->limits.max_sectors > q->limits.max_hw_sectors) {
37043704
q->limits.max_sectors = rw_max;
3705+
q->limits.max_user_sectors = rw_max;
3706+
}
37053707

37063708
sdkp->first_scan = 0;
37073709

0 commit comments

Comments
 (0)