Message ID | yq1r2lkehnz.fsf@oracle.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Hey Martin. On Tue, 2018-06-05 at 23:08 -0400, Martin K. Petersen wrote: > We have had devices with bogus values before. The problem in this > case > is that 32M is a large, but not entirely unreasonable, stripe I/O > width > for a storage array. Well I guess at least if it's not a multiple of the block size, one can safely assume it bogus, can't one? > Does this fix it for you? I applied it to 4.16.12 from Debian and created new packages with it (don't think I made any error there)... but there was no change, and lsblk still showed the same opt io sizes. :-( Cheers, Chris.
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 9421d9877730..4e2fdfa870c2 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3126,12 +3126,13 @@ static int sd_revalidate_disk(struct gendisk *disk) /* * Determine the device's preferred I/O size for reads and writes - * unless the reported value is unreasonably small, large, or - * garbage. + * unless the reported value is unreasonably small, large, not a + * multiple of the physical block size, or simply garbage. */ if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max && sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS && + sdkp->opt_xfer_blocks & sdkp->physical_block_size - 1 != 0 && logical_to_bytes(sdp, sdkp->opt_xfer_blocks) >= PAGE_SIZE) { q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks); rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);