Commit 7387c496 authored by Anand Lodnoor's avatar Anand Lodnoor Committed by Greg Kroah-Hartman

scsi: megaraid_sas: Do not initiate OCR if controller is not in ready state

commit 6d753727 upstream.

Driver initiates OCR if a DCMD command times out. But there is a deadlock
if the driver attempts to invoke another OCR before the mutex lock
(reset_mutex) is released from the previous session of OCR.

This patch takes care of the above scenario using new flag
MEGASAS_FUSION_OCR_NOT_POSSIBLE to indicate if OCR is possible.

Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/1579000882-20246-9-git-send-email-anand.lodnoor@broadcom.comSigned-off-by: default avatarShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: default avatarAnand Lodnoor <anand.lodnoor@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 029f7c4a
...@@ -3978,7 +3978,8 @@ dcmd_timeout_ocr_possible(struct megasas_instance *instance) { ...@@ -3978,7 +3978,8 @@ dcmd_timeout_ocr_possible(struct megasas_instance *instance) {
if (!instance->ctrl_context) if (!instance->ctrl_context)
return KILL_ADAPTER; return KILL_ADAPTER;
else if (instance->unload || else if (instance->unload ||
test_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags)) test_bit(MEGASAS_FUSION_OCR_NOT_POSSIBLE,
&instance->reset_flags))
return IGNORE_TIMEOUT; return IGNORE_TIMEOUT;
else else
return INITIATE_OCR; return INITIATE_OCR;
......
...@@ -3438,6 +3438,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) ...@@ -3438,6 +3438,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
if (instance->requestorId && !instance->skip_heartbeat_timer_del) if (instance->requestorId && !instance->skip_heartbeat_timer_del)
del_timer_sync(&instance->sriov_heartbeat_timer); del_timer_sync(&instance->sriov_heartbeat_timer);
set_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); set_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags);
set_bit(MEGASAS_FUSION_OCR_NOT_POSSIBLE, &instance->reset_flags);
atomic_set(&instance->adprecovery, MEGASAS_ADPRESET_SM_POLLING); atomic_set(&instance->adprecovery, MEGASAS_ADPRESET_SM_POLLING);
instance->instancet->disable_intr(instance); instance->instancet->disable_intr(instance);
msleep(1000); msleep(1000);
...@@ -3594,7 +3595,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason) ...@@ -3594,7 +3595,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
atomic_set(&instance->adprecovery, MEGASAS_HBA_OPERATIONAL); atomic_set(&instance->adprecovery, MEGASAS_HBA_OPERATIONAL);
} }
out: out:
clear_bit(MEGASAS_FUSION_IN_RESET, &instance->reset_flags); clear_bit(MEGASAS_FUSION_OCR_NOT_POSSIBLE, &instance->reset_flags);
mutex_unlock(&instance->reset_mutex); mutex_unlock(&instance->reset_mutex);
return retval; return retval;
} }
......
...@@ -93,6 +93,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE { ...@@ -93,6 +93,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE {
#define MEGASAS_FP_CMD_LEN 16 #define MEGASAS_FP_CMD_LEN 16
#define MEGASAS_FUSION_IN_RESET 0 #define MEGASAS_FUSION_IN_RESET 0
#define MEGASAS_FUSION_OCR_NOT_POSSIBLE 1
#define THRESHOLD_REPLY_COUNT 50 #define THRESHOLD_REPLY_COUNT 50
#define JBOD_MAPS_COUNT 2 #define JBOD_MAPS_COUNT 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment