scsi: megaraid_sas: Return pended IOCTLs with cmd_status MFI_STAT_WRONG_STATE in...
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Wed, 23 Aug 2017 11:47:04 +0000 (04:47 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 25 Aug 2017 02:29:14 +0000 (22:29 -0400)
After a kill adapter, since the cmd_status is not set, the IOCTLs will
be hung in driver resulting in application hang.  Set cmd_status
MFI_STAT_WRONG_STATE when completing pended IOCTLs.

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Cc: stable@vger.kernel.org
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid/megaraid_sas_base.c

index 6b715bb905112fcee9359ab47640327fcfaa7bcb..a949a2111b08611ece165562e3f3fe43a8f60ec8 100644 (file)
@@ -1996,9 +1996,12 @@ static void megasas_complete_outstanding_ioctls(struct megasas_instance *instanc
                        if (cmd_fusion->sync_cmd_idx != (u32)ULONG_MAX) {
                                cmd_mfi = instance->cmd_list[cmd_fusion->sync_cmd_idx];
                                if (cmd_mfi->sync_cmd &&
-                                       cmd_mfi->frame->hdr.cmd != MFI_CMD_ABORT)
+                                   (cmd_mfi->frame->hdr.cmd != MFI_CMD_ABORT)) {
+                                       cmd_mfi->frame->hdr.cmd_status =
+                                                       MFI_STAT_WRONG_STATE;
                                        megasas_complete_cmd(instance,
                                                             cmd_mfi, DID_OK);
+                               }
                        }
                }
        } else {