Skip to content

Commit eac6f76

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fix from James Bottomley: "A single fix for machines with pages > 4k (PPC mostly). There's a bug in our optimal transfer size code where we don't account for pages > 4k and can set the transfer size to be less than the page size causing nasty failures" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: sd: Reject optimal transfer length smaller than page size
2 parents c0cb139 + f9ec0d5 commit eac6f76

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/scsi/sd.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,10 +2885,13 @@ static int sd_revalidate_disk(struct gendisk *disk)
28852885

28862886
/*
28872887
* Use the device's preferred I/O size for reads and writes
2888-
* unless the reported value is unreasonably large (or garbage).
2888+
* unless the reported value is unreasonably small, large, or
2889+
* garbage.
28892890
*/
2890-
if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max &&
2891-
sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS)
2891+
if (sdkp->opt_xfer_blocks &&
2892+
sdkp->opt_xfer_blocks <= dev_max &&
2893+
sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
2894+
sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE)
28922895
rw_max = q->limits.io_opt =
28932896
logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
28942897
else

0 commit comments

Comments
 (0)