linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Lodnoor <anand.lodnoor@broadcom.com>
To: linux-scsi@vger.kernel.org
Cc: kashyap.desai@broadcom.com, sumit.saxena@broadcom.com,
	kiran-kumar.kasturi@broadcom.com,
	Anand Lodnoor <anand.lodnoor@broadcom.com>,
	stable@vger.kernel.org,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Subject: [PATCH 08/11] megaraid_sas: Do not initiate OCR if controller is not in ready state
Date: Fri,  3 Jan 2020 17:02:32 +0530	[thread overview]
Message-ID: <1578051155-14716-9-git-send-email-anand.lodnoor@broadcom.com> (raw)
In-Reply-To: <1578051155-14716-1-git-send-email-anand.lodnoor@broadcom.com>

Driver can initiate OCR if DCMD command is timeout, but there is a
deadlock if the driver attempts to invoke another OCR  before the
mutex lock 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 or not.

Cc: stable@vger.kernel.org
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Anand Lodnoor <anand.lodnoor@broadcom.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 3 ++-
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 ++-
 drivers/scsi/megaraid/megaraid_sas_fusion.h | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 8bc4076..da47c8b 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4404,7 +4404,8 @@ int megasas_alloc_cmds(struct megasas_instance *instance)
 	if (instance->adapter_type == MFI_SERIES)
 		return KILL_ADAPTER;
 	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;
 	else
 		return INITIATE_OCR;
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 6860fd2..8b6cc1b 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -4851,6 +4851,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 	if (instance->requestorId && !instance->skip_heartbeat_timer_del)
 		del_timer_sync(&instance->sriov_heartbeat_timer);
 	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);
 	instance->instancet->disable_intr(instance);
 	megasas_sync_irqs((unsigned long)instance);
@@ -5059,7 +5060,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int reason)
 	instance->skip_heartbeat_timer_del = 1;
 	retval = FAILED;
 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);
 	return retval;
 }
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.h b/drivers/scsi/megaraid/megaraid_sas_fusion.h
index 8358b68..d57ecc7 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.h
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.h
@@ -89,6 +89,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE {
 
 #define MEGASAS_FP_CMD_LEN	16
 #define MEGASAS_FUSION_IN_RESET 0
+#define MEGASAS_FUSION_OCR_NOT_POSSIBLE 1
 #define RAID_1_PEER_CMDS 2
 #define JBOD_MAPS_COUNT	2
 #define MEGASAS_REDUCE_QD_COUNT 64
-- 
1.8.3.1


  parent reply	other threads:[~2020-01-03 11:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-03 11:32 [PATCH 00/11] megaraid_sas: driver updates to 07.713.01.00-rc1 Anand Lodnoor
2020-01-03 11:32 ` [PATCH 01/11] megaraid_sas: Add transition_to_ready retry logic in resume path Anand Lodnoor
2020-01-10  6:00   ` Martin K. Petersen
2020-01-03 11:32 ` [PATCH 02/11] megaraid_sas: Set no_write_same only for Virtual Disk Anand Lodnoor
2020-01-03 11:32 ` [PATCH 03/11] megaraid_sas: Update queue_depth of SAS and NVMe devices Anand Lodnoor
2020-01-10  6:03   ` Martin K. Petersen
2020-01-03 11:32 ` =?y?q?=5BPATCH=2004/11=5D=20megaraid=5Fsas=3A=20Don=E2=80=99t=20kill=20already=20dead=20adapter?= Anand Lodnoor
2020-01-10  6:03   ` .PATCH.04/11.megaraid.sas.Don.t.kill.already.dead.adapter Martin K. Petersen
2020-01-03 11:32 ` [PATCH 05/11] megaraid_sas: Do not kill HBA if JBOD Seqence map or RAID map is disabled Anand Lodnoor
2020-01-03 11:32 ` [PATCH 06/11] megaraid_sas: Do not set HBA Operational if FW is not in operational state Anand Lodnoor
2020-01-03 11:32 ` [PATCH 07/11] megaraid_sas: Re-Define enum DCMD_RETURN_STATUS Anand Lodnoor
2020-01-03 11:32 ` Anand Lodnoor [this message]
     [not found]   ` <20200104053110.9D26124649@mail.kernel.org>
2020-01-07  7:59     ` [PATCH 08/11] megaraid_sas: Do not initiate OCR if controller is not in ready state Sumit Saxena
2020-01-03 11:32 ` [PATCH 09/11] megaraid_sas: Return pended IOCTLs after 3 retries Anand Lodnoor
2020-01-03 11:32 ` [PATCH 10/11] megaraid_sas: Use Block layer API to check SCSI device in-flight IO requests Anand Lodnoor
2020-01-03 11:32 ` [PATCH 11/11] megaraid_sas: Update driver version to 07.713.01.00-rc1 Anand Lodnoor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1578051155-14716-9-git-send-email-anand.lodnoor@broadcom.com \
    --to=anand.lodnoor@broadcom.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=kiran-kumar.kasturi@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=stable@vger.kernel.org \
    --cc=sumit.saxena@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).