Commit de2efea6 authored by Nilesh Javali's avatar Nilesh Javali Committed by James Bottomley

[SCSI] qla4xxx: Clear DDB index map upon connection close failure

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: default avatarNilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: default avatarVikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent bb5649f3
...@@ -297,6 +297,8 @@ struct ddb_entry { ...@@ -297,6 +297,8 @@ struct ddb_entry {
/* Driver Re-login */ /* Driver Re-login */
unsigned long flags; /* DDB Flags */ unsigned long flags; /* DDB Flags */
#define DDB_CONN_CLOSE_FAILURE 0 /* 0x00000001 */
uint16_t default_relogin_timeout; /* Max time to wait for uint16_t default_relogin_timeout; /* Max time to wait for
* relogin to complete */ * relogin to complete */
atomic_t retry_relogin_timer; /* Min Time between relogins atomic_t retry_relogin_timer; /* Min Time between relogins
......
...@@ -390,6 +390,7 @@ struct qla_flt_region { ...@@ -390,6 +390,7 @@ struct qla_flt_region {
#define MBOX_CMD_CLEAR_DATABASE_ENTRY 0x0031 #define MBOX_CMD_CLEAR_DATABASE_ENTRY 0x0031
#define MBOX_CMD_CONN_OPEN 0x0074 #define MBOX_CMD_CONN_OPEN 0x0074
#define MBOX_CMD_CONN_CLOSE_SESS_LOGOUT 0x0056 #define MBOX_CMD_CONN_CLOSE_SESS_LOGOUT 0x0056
#define DDB_NOT_LOGGED_IN 0x09
#define LOGOUT_OPTION_CLOSE_SESSION 0x0002 #define LOGOUT_OPTION_CLOSE_SESSION 0x0002
#define LOGOUT_OPTION_RELOGIN 0x0004 #define LOGOUT_OPTION_RELOGIN 0x0004
#define LOGOUT_OPTION_FREE_DDB 0x0008 #define LOGOUT_OPTION_FREE_DDB 0x0008
......
...@@ -1002,6 +1002,10 @@ int qla4xxx_session_logout_ddb(struct scsi_qla_host *ha, ...@@ -1002,6 +1002,10 @@ int qla4xxx_session_logout_ddb(struct scsi_qla_host *ha,
"%s: MBOX_CMD_CONN_CLOSE_SESS_LOGOUT " "%s: MBOX_CMD_CONN_CLOSE_SESS_LOGOUT "
"failed sts %04X %04X", __func__, "failed sts %04X %04X", __func__,
mbox_sts[0], mbox_sts[1])); 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; return status;
......
...@@ -3074,6 +3074,7 @@ qla4xxx_session_create(struct iscsi_endpoint *ep, ...@@ -3074,6 +3074,7 @@ qla4xxx_session_create(struct iscsi_endpoint *ep,
ddb_entry->sess = cls_sess; ddb_entry->sess = cls_sess;
ddb_entry->unblock_sess = qla4xxx_unblock_ddb; ddb_entry->unblock_sess = qla4xxx_unblock_ddb;
ddb_entry->ddb_change = qla4xxx_ddb_change; ddb_entry->ddb_change = qla4xxx_ddb_change;
clear_bit(DDB_CONN_CLOSE_FAILURE, &ddb_entry->flags);
cls_sess->recovery_tmo = ql4xsess_recovery_tmo; cls_sess->recovery_tmo = ql4xsess_recovery_tmo;
ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry; ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = ddb_entry;
ha->tot_ddbs++; ha->tot_ddbs++;
...@@ -3123,7 +3124,8 @@ static void qla4xxx_session_destroy(struct iscsi_cls_session *cls_sess) ...@@ -3123,7 +3124,8 @@ static void qla4xxx_session_destroy(struct iscsi_cls_session *cls_sess)
destroy_session: destroy_session:
qla4xxx_clear_ddb_entry(ha, ddb_entry->fw_ddb_index); 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); spin_lock_irqsave(&ha->hardware_lock, flags);
qla4xxx_free_ddb(ha, ddb_entry); qla4xxx_free_ddb(ha, ddb_entry);
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
......
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