diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-09 17:53:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-09 17:53:48 -0500 |
commit | eac6f76ac72c0a7e6f6d4f1640be751a526b5de2 (patch) | |
tree | 70f962fcd4a9893eabd1cc1f7c14d014ba2e54b5 | |
parent | c0cb1393459598977cb1b919da5ddf6b2833c155 (diff) | |
parent | f9ec0d559ef8d36266b52314e8c0158327572726 (diff) |
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
-rw-r--r-- | drivers/scsi/sd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 3d22fc3e3c1a..4e08d1cd704d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -2885,10 +2885,13 @@ static int sd_revalidate_disk(struct gendisk *disk) | |||
2885 | 2885 | ||
2886 | /* | 2886 | /* |
2887 | * Use the device's preferred I/O size for reads and writes | 2887 | * 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. | ||
2889 | */ | 2890 | */ |
2890 | if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max && | 2891 | if (sdkp->opt_xfer_blocks && |
2891 | sdkp->opt_xfer_blocks <= SD_DEF_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) | ||
2892 | rw_max = q->limits.io_opt = | 2895 | rw_max = q->limits.io_opt = |
2893 | logical_to_sectors(sdp, sdkp->opt_xfer_blocks); | 2896 | logical_to_sectors(sdp, sdkp->opt_xfer_blocks); |
2894 | else | 2897 | else |