Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eac6f76a authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents c0cb1393 f9ec0d55
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -2885,10 +2885,13 @@ static int sd_revalidate_disk(struct gendisk *disk)

	/*
	 * Use the device's preferred I/O size for reads and writes
	 * unless the reported value is unreasonably large (or garbage).
	 * unless the reported value is unreasonably small, large, or
	 * garbage.
	 */
	if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max &&
	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS)
	if (sdkp->opt_xfer_blocks &&
	    sdkp->opt_xfer_blocks <= dev_max &&
	    sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
	    sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE)
		rw_max = q->limits.io_opt =
			logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
	else