scsi: mpt3sas: Force request partial completion alignment
authorRam Pai <linuxram@us.ibm.com>
Thu, 26 Jan 2017 18:37:01 +0000 (16:37 -0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 1 Feb 2017 03:36:53 +0000 (22:36 -0500)
commitf2e767bb5d6ee0d988cb7d4e54b0b21175802b6b
tree02856806fddc633c2ff9f24703feba2d4e402b56
parent2780f3c8f0233de90b6b47a23fc422b7780c5436
scsi: mpt3sas: Force request partial completion alignment

The firmware or device, possibly under a heavy I/O load, can return on a
partial unaligned boundary. Scsi-ml expects these requests to be
completed on an alignment boundary. Scsi-ml blindly requeues the I/O
without checking the alignment boundary of the I/O request for the
remaining bytes. This leads to errors, since devices cannot perform
non-aligned read/write operations.

This patch fixes the issue in the driver. It aligns unaligned
completions of FS requests, by truncating them to the nearest alignment
boundary.

[mkp: simplified if statement]

Reported-by: Mauricio Faria De Oliveira <mauricfo@linux.vnet.ibm.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_scsih.c