linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <vikas.chaudhary@qlogic.com>
To: jbottomley@parallels.com, michaelc@cs.wisc.edu
Cc: linux-scsi@vger.kernel.org, vikas.chaudhary@qlogic.com,
	lalit.chandivade@qlogic.com,
	Nilesh Javali <nilesh.javali@qlogic.com>
Subject: [PATCH 10/24] qla4xxx: Clear DDB index map upon connection close failure
Date: Mon, 16 Dec 2013 06:49:40 -0500	[thread overview]
Message-ID: <1387194594-29817-11-git-send-email-vikas.chaudhary@qlogic.com> (raw)
In-Reply-To: <1387194594-29817-1-git-send-email-vikas.chaudhary@qlogic.com>

From: Nilesh Javali <nilesh.javali@qlogic.com>

Issue:
qla4xxx Unable to clear DDB indices when logout fails due to
failure of connection close mbox command.

Root cause:
If login to session fail, iscsiadm make call to destroy_session.
qla4xxx driver does not free ddb index map before free_ddb()

Fix:
Clear DDB Index map before free_ddb in "destroy_session"
in case of connection close mailbox command failure with 4005h.

Signed-off-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
---
 drivers/scsi/qla4xxx/ql4_def.h | 2 ++
 drivers/scsi/qla4xxx/ql4_fw.h  | 1 +
 drivers/scsi/qla4xxx/ql4_mbx.c | 4 ++++
 drivers/scsi/qla4xxx/ql4_os.c  | 4 +++-
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 4e11133..33eae2e 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -297,6 +297,8 @@ struct ddb_entry {
 
 	/* Driver Re-login  */
 	unsigned long flags;		  /* DDB Flags */
+#define DDB_CONN_CLOSE_FAILURE		0 /* 0x00000001 */
+
 	uint16_t default_relogin_timeout; /*  Max time to wait for
 					   *  relogin to complete */
 	atomic_t retry_relogin_timer;	  /* Min Time between relogins
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index e3242df..a94593a 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -390,6 +390,7 @@ struct qla_flt_region {
 #define MBOX_CMD_CLEAR_DATABASE_ENTRY		0x0031
 #define MBOX_CMD_CONN_OPEN			0x0074
 #define MBOX_CMD_CONN_CLOSE_SESS_LOGOUT		0x0056
+#define DDB_NOT_LOGGED_IN			0x09
 #define LOGOUT_OPTION_CLOSE_SESSION		0x0002
 #define LOGOUT_OPTION_RELOGIN			0x0004
 #define LOGOUT_OPTION_FREE_DDB			0x0008
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 7da0646..023f2dd 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1002,6 +1002,10 @@ int qla4xxx_session_logout_ddb(struct scsi_qla_host *ha,
 				  "%s: MBOX_CMD_CONN_CLOSE_SESS_LOGOUT "
 				  "failed sts %04X %04X", __func__,
 				  mbox_sts[0], mbox_sts[1]));
+		if ((mbox_sts[0] == MBOX_STS_COMMAND_ERROR) &&
+		    (mbox_sts[1] == DDB_NOT_LOGGED_IN)) {
+			set_bit(DDB_CONN_CLOSE_FAILURE, &ddb_entry->flags);
+		}
 	}
 
 	return status;
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index a78edc3..3fec116 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -3074,6 +3074,7 @@ qla4xxx_session_create(struct iscsi_endpoint *ep,
 	ddb_entry->sess = cls_sess;
 	ddb_entry->unblock_sess = qla4xxx_unblock_ddb;
 	ddb_entry->ddb_change = qla4xxx_ddb_change;
+	clear_bit(DDB_CONN_CLOSE_FAILURE, &ddb_entry->flags);
 	cls_sess->recovery_tmo = ql4xsess_recovery_tmo;
 	ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry;
 	ha->tot_ddbs++;
@@ -3123,7 +3124,8 @@ static void qla4xxx_session_destroy(struct iscsi_cls_session *cls_sess)
 
 destroy_session:
 	qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index);
-
+	if (test_and_clear_bit(DDB_CONN_CLOSE_FAILURE, &ddb_entry->flags))
+		clear_bit(ddb_entry->fw_ddb_index, ha->ddb_idx_map);
 	spin_lock_irqsave(&ha->hardware_lock, flags);
 	qla4xxx_free_ddb(ha, ddb_entry);
 	spin_unlock_irqrestore(&ha->hardware_lock, flags);
-- 
1.8.2.GIT


  parent reply	other threads:[~2013-12-16 12:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 11:49 [PATCH 0/24] qla4xxx: 5.04.00-k4: Updates for scsi "misc" branch vikas.chaudhary
2013-12-16 11:49 ` [PATCH 01/24] qla4xxx: ISP8xxx: Correct retry of adapter initialization vikas.chaudhary
2013-12-16 11:49 ` [PATCH 02/24] qla4xxx: Print WARN_ONCE() if iSCSI function presence bit removed vikas.chaudhary
2013-12-16 11:49 ` [PATCH 03/24] qla4xxx: Fix comments in code vikas.chaudhary
2013-12-16 11:49 ` [PATCH 04/24] qla4xxx: Use IDC_CTRL bit1 directly instead of AF_83XX_NO_FWDUMP flag vikas.chaudhary
2013-12-16 11:49 ` [PATCH 05/24] qla4xxx: Improve loopback failure messages vikas.chaudhary
2013-12-16 11:49 ` [PATCH 06/24] qla4xxx: Rename ACB_STATE macros with IP_ADDRSTATE macros vikas.chaudhary
2013-12-16 11:49 ` [PATCH 07/24] qla4xxx: Correctly handle msleep_interruptible vikas.chaudhary
2013-12-16 11:49 ` [PATCH 08/24] qla4xxx: Fixed AER reset sequence for ISP83xx/ISP84xx vikas.chaudhary
2013-12-16 11:49 ` [PATCH 09/24] qla4xxx: Return correct error status from func qla4xxx_request_irqs() vikas.chaudhary
2013-12-16 11:49 ` vikas.chaudhary [this message]
2013-12-16 11:49 ` [PATCH 11/24] qla4xxx: Fix failure of IDC Time Extend mailbox command vikas.chaudhary
2013-12-16 11:49 ` [PATCH 12/24] qla4xxx: Fix processing response queue during probe vikas.chaudhary
2013-12-16 11:49 ` [PATCH 13/24] qla4xxx: Fix pending IO completion in reset path before initiating chip reset vikas.chaudhary
2013-12-16 11:49 ` [PATCH 14/24] qla4xxx: Driver not able to collect minidump for ISP84xx vikas.chaudhary
2013-12-16 11:49 ` [PATCH 15/24] qla4xxx: Reduce rom-lock contention during reset recovery vikas.chaudhary
2013-12-16 11:49 ` [PATCH 16/24] qla4xxx: Fix failure of mbox 0x31 vikas.chaudhary
2014-01-17  8:30   ` Mike Christie
2014-01-17 10:34     ` Vikas Chaudhary
2013-12-16 11:49 ` [PATCH 17/24] qla4xxx: Remove unused code from qla4xxx_set_ifcb() vikas.chaudhary
2013-12-16 11:49 ` [PATCH 18/24] qla4xxx: Updated print for device login, logout path vikas.chaudhary
2013-12-16 11:49 ` [PATCH 19/24] qla4xxx: Update print statements in qla4xxx_mailbox_command() vikas.chaudhary
2013-12-16 11:49 ` [PATCH 20/24] qla4xxx: Update print statements in func qla4xxx_eh_abort() vikas.chaudhary
2013-12-16 11:49 ` [PATCH 21/24] qla4xxx: Update print statements in func qla4xxx_do_dpc() vikas.chaudhary
2013-12-16 11:49 ` [PATCH 22/24] qla4xxx: Handle IPv6 AEN notifications vikas.chaudhary
2013-12-16 11:49 ` [PATCH 23/24] qla4xxx: Fix sparse warnings vikas.chaudhary
2013-12-16 11:49 ` [PATCH 24/24] qla4xxx: Update driver version to 5.04.00-k4 vikas.chaudhary
2014-01-17 18:20 ` [PATCH 0/24] qla4xxx: 5.04.00-k4: Updates for scsi "misc" branch Mike Christie

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=1387194594-29817-11-git-send-email-vikas.chaudhary@qlogic.com \
    --to=vikas.chaudhary@qlogic.com \
    --cc=jbottomley@parallels.com \
    --cc=lalit.chandivade@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=nilesh.javali@qlogic.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).