]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: megaraid_sas: set residual bytes count during IO completion
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Fri, 10 Feb 2017 08:59:14 +0000 (00:59 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 1 Jun 2017 21:06:02 +0000 (14:06 -0700)
Orabug: 26096381

Fixing issue of not setting residual bytes correctly.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 31d9a57b419d8ef8fa391009819f940778ce6245)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
Reviewed-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/scsi/megaraid/megaraid_sas_fusion.c

index 6841e722fbb5c2bcdfe64975fd313fe964276531..fbfa837df152ac9f60459a5e5406deece5444f69 100644 (file)
@@ -1443,6 +1443,7 @@ map_cmd_status(struct fusion_context *fusion,
        struct scsi_cmnd *scmd, u8 status, u8 ext_status,
                        u32 data_length, u8 *sense)
 {
+       int resid;
 
        switch (status) {
 
@@ -1465,6 +1466,15 @@ map_cmd_status(struct fusion_context *fusion,
                               SCSI_SENSE_BUFFERSIZE);
                        scmd->result |= DRIVER_SENSE << 24;
                }
+
+               /*
+                * If the  IO request is partially completed, then MR FW will
+                * update "io_request->DataLength" field with actual number of
+                * bytes transferred.Driver will set residual bytes count in
+                * SCSI command structure.
+                */
+               resid = (scsi_bufflen(scmd) - data_length);
+               scsi_set_resid(scmd, resid);
                break;
 
        case MFI_STAT_LD_OFFLINE: