Skip to content

Commit 1d5de5b

Browse files
scsi: sd: Quiesce warning if device does not report optimal I/O size
Commit a83da8a ("scsi: sd: Optimal I/O size should be a multiple of physical block size") split one conditional into several separate statements in an effort to provide more accurate warning messages when a device reports a nonsensical value. However, this reorganization accidentally dropped the precondition of the reported value being larger than zero. This lead to a warning getting emitted on devices that do not report an optimal I/O size at all. Remain silent if a device does not report an optimal I/O size. Fixes: a83da8a ("scsi: sd: Optimal I/O size should be a multiple of physical block size") Cc: Randy Dunlap <rdunlap@infradead.org> Cc: <stable@vger.kernel.org> Reported-by: Hussam Al-Tayeb <ht990332@gmx.com> Tested-by: Hussam Al-Tayeb <ht990332@gmx.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent c14a572 commit 1d5de5b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/scsi/sd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3071,6 +3071,9 @@ static bool sd_validate_opt_xfer_size(struct scsi_disk *sdkp,
30713071
unsigned int opt_xfer_bytes =
30723072
logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
30733073

3074+
if (sdkp->opt_xfer_blocks == 0)
3075+
return false;
3076+
30743077
if (sdkp->opt_xfer_blocks > dev_max) {
30753078
sd_first_printk(KERN_WARNING, sdkp,
30763079
"Optimal transfer size %u logical blocks " \

0 commit comments

Comments
 (0)