sd: Reject optimal transfer length smaller than page size
authorMartin K. Petersen <martin.petersen@oracle.com>
Wed, 16 Dec 2015 22:53:52 +0000 (17:53 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 22 Dec 2015 02:37:18 +0000 (21:37 -0500)
commit9c1d9c207bb800498347a2716da298043ee280c5
treee05d8f3b152b028d81d5b2694dfd533023bf54db
parent1c69d3b6eb73e466ecbb8edaf1bc7fd585b288da
sd: Reject optimal transfer length smaller than page size

Eryu Guan reported that loading scsi_debug would fail. This turned out
to be caused by scsi_debug reporting an optimal I/O size of 32KB which
is smaller than the 64KB page size on the PowerPC system in question.

Add a check to ensure that we only use the device-reported OPTIMAL
TRANSFER LENGTH if it is bigger than or equal to the page cache size.

Reported-by: Eryu Guan <guaneryu@gmail.com>
Reported-by: Ming Lei <tom.leiming@gmail.com>
Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c