From: Chad Dupuis <chad.dupuis@qlogic.com>
To: jbottomley@parallels.com
Cc: giridhar.malavali@qlogic.com, chad.dupuis@qlogic.com,
andrew.vasquez@qlogic.com, linux-scsi@vger.kernel.org
Subject: [PATCH 26/29] qla2xxx: Handle device mapping changes due to device logout.
Date: Thu, 9 Feb 2012 11:15:58 -0800 [thread overview]
Message-ID: <1328814961-21866-27-git-send-email-chad.dupuis@qlogic.com> (raw)
In-Reply-To: <1328814961-21866-1-git-send-email-chad.dupuis@qlogic.com>
From: Arun Easi <arun.easi@qlogic.com>
A device logout sent in the delete path of a fcport would clear the
port handle binding inside the firmware. This could lead to queued
work items for the fcport, if any, getting incorrect results. This
patch fixes the issue by checking for device name changes after a
call to get port database.
Signed-off-by: Arun Easi <arun.easi@qlogic.com>
Signed-off-by: Chad Dupuis <chad.dupuis@qlogic.com>
---
drivers/scsi/qla2xxx/qla_init.c | 8 ++++++++
drivers/scsi/qla2xxx/qla_mbx.c | 19 +++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 2627c87..b946564 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -350,6 +350,13 @@ qla2x00_async_login_done(struct scsi_qla_host *vha, fc_port_t *fcport,
* requests.
*/
rval = qla2x00_get_port_database(vha, fcport, 0);
+ if (rval == QLA_NOT_LOGGED_IN) {
+ fcport->flags &= ~FCF_ASYNC_SENT;
+ fcport->flags |= FCF_LOGIN_NEEDED;
+ set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
+ break;
+ }
+
if (rval != QLA_SUCCESS) {
qla2x00_post_async_logout_work(vha, fcport, NULL);
qla2x00_post_async_login_work(vha, fcport, NULL);
@@ -3318,6 +3325,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha,
fcport->flags |= FCF_LOGIN_NEEDED;
if (fcport->loop_id != FC_NO_LOOP_ID &&
(fcport->flags & FCF_FCP2_DEVICE) == 0 &&
+ (fcport->flags & FCF_ASYNC_SENT) == 0 &&
fcport->port_type != FCT_INITIATOR &&
fcport->port_type != FCT_BROADCAST) {
ha->isp_ops->fabric_logout(vha, fcport->loop_id,
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index adc2b14..b4a2339 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -1289,6 +1289,7 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt)
goto gpd_error_out;
if (IS_FWI2_CAPABLE(ha)) {
+ uint64_t zero = 0;
pd24 = (struct port_database_24xx *) pd;
/* Check for logged in state. */
@@ -1302,6 +1303,14 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt)
goto gpd_error_out;
}
+ if (fcport->loop_id == FC_NO_LOOP_ID ||
+ (memcmp(fcport->port_name, (uint8_t *)&zero, 8) &&
+ memcmp(fcport->port_name, pd24->port_name, 8))) {
+ /* We lost the device mid way. */
+ rval = QLA_NOT_LOGGED_IN;
+ goto gpd_error_out;
+ }
+
/* Names are little-endian. */
memcpy(fcport->node_name, pd24->node_name, WWN_SIZE);
memcpy(fcport->port_name, pd24->port_name, WWN_SIZE);
@@ -1318,6 +1327,8 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt)
else
fcport->port_type = FCT_TARGET;
} else {
+ uint64_t zero = 0;
+
/* Check for logged in state. */
if (pd->master_state != PD_STATE_PORT_LOGGED_IN &&
pd->slave_state != PD_STATE_PORT_LOGGED_IN) {
@@ -1330,6 +1341,14 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt)
goto gpd_error_out;
}
+ if (fcport->loop_id == FC_NO_LOOP_ID ||
+ (memcmp(fcport->port_name, (uint8_t *)&zero, 8) &&
+ memcmp(fcport->port_name, pd->port_name, 8))) {
+ /* We lost the device mid way. */
+ rval = QLA_NOT_LOGGED_IN;
+ goto gpd_error_out;
+ }
+
/* Names are little-endian. */
memcpy(fcport->node_name, pd->node_name, WWN_SIZE);
memcpy(fcport->port_name, pd->port_name, WWN_SIZE);
--
1.6.0.2
next prev parent reply other threads:[~2012-02-09 19:32 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 19:15 [PATCH 00/29] qla2xxx: Patches for scsi-misc Chad Dupuis
2012-02-09 19:15 ` [PATCH 01/29] qla2xxx: Enhanced the dump routines to capture multiple request and response queues Chad Dupuis
2012-02-09 19:15 ` [PATCH 02/29] qla2xxx: Enhancements to support ISP83xx Chad Dupuis
2012-02-09 19:15 ` [PATCH 03/29] qla2xxx: Use a valid enode-mac if none defined Chad Dupuis
2012-02-09 19:15 ` [PATCH 04/29] qla2xxx: Consolidation of SRB processing Chad Dupuis
2012-02-09 19:15 ` [PATCH 05/29] qla2xxx: Use consistent DL mask for ELS/CT passthru requests Chad Dupuis
2012-02-09 19:15 ` [PATCH 06/29] qla2xxx: Correct print format for edc ql_log() calls Chad Dupuis
2012-02-09 19:15 ` [PATCH 07/29] qla2xxx: Handle change notifications based on switch scan results Chad Dupuis
2012-02-09 19:15 ` [PATCH 08/29] qla2xxx: Return blank sysfs string on initial get thermal failure Chad Dupuis
2012-02-09 19:15 ` [PATCH 09/29] qla2xxx: Increase speed of flash access in ISP82xx adapters to improve firmware load speed Chad Dupuis
2012-02-09 19:15 ` [PATCH 10/29] qla2xxx: Handle failure cases during fabric_login Chad Dupuis
2012-02-09 19:15 ` [PATCH 11/29] qla2xxx: Perform implicit logout during rport tear-down Chad Dupuis
2012-02-09 19:15 ` [PATCH 12/29] qla2xxx: Prep zero-length BSG data-transfer requests Chad Dupuis
2012-02-09 19:15 ` [PATCH 13/29] qla2xxx: Reduce mbx-command timeout for Login/Logout requests Chad Dupuis
2012-02-09 19:15 ` [PATCH 14/29] qla2xxx: Print mailbox command opcode and return code when a command times out Chad Dupuis
2012-02-09 19:15 ` [PATCH 15/29] qla2xxx: Convert remaining printk's to ql_log format Chad Dupuis
2012-02-09 19:15 ` [PATCH 16/29] qla2xxx: Use ql_log* #define's in ql_log() and ql_log_pci() Chad Dupuis
2012-02-09 19:15 ` [PATCH 17/29] qla2xxx: Fix ql_dbg arguments Chad Dupuis
2012-02-09 19:15 ` [PATCH 18/29] qla2xxx: Add new message when a new loopid is assigned Chad Dupuis
2012-02-09 19:15 ` [PATCH 19/29] qla2xxx: Log messages to use correct vha Chad Dupuis
2012-02-09 19:15 ` [PATCH 20/29] qla2xxx: Change the log message when previous dump is available to retrieve for ISP82xx Chad Dupuis
2012-02-09 19:15 ` [PATCH 21/29] qla2xxx: Perform firmware dump procedure on mailbox command timeout Chad Dupuis
2012-02-09 19:15 ` [PATCH 22/29] qla2xxx: Update LICENSE.qla2xxx Chad Dupuis
2012-02-09 19:15 ` [PATCH 23/29] qla2xxx: Remove EDC sysfs interface Chad Dupuis
2012-02-09 19:15 ` [PATCH 24/29] qla2xxx: Cache swl during fabric discovery Chad Dupuis
2012-02-09 19:15 ` [PATCH 25/29] qla2xxx: Add ha->max_fibre_devices to keep track of the maximum number of targets Chad Dupuis
2012-02-19 14:33 ` James Bottomley
2012-02-09 19:15 ` Chad Dupuis [this message]
2012-02-09 19:15 ` [PATCH 27/29] qla2xxx: Fix incorrect register access in qla2x00_start_iocbs() Chad Dupuis
2012-02-09 19:16 ` [PATCH 28/29] qla2xxx: Stop iteration after first failure in *_id functions Chad Dupuis
2012-02-09 19:16 ` [PATCH 29/29] qla2xxx: Avoid invalid request queue dereference for bad response packets Chad Dupuis
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=1328814961-21866-27-git-send-email-chad.dupuis@qlogic.com \
--to=chad.dupuis@qlogic.com \
--cc=andrew.vasquez@qlogic.com \
--cc=giridhar.malavali@qlogic.com \
--cc=jbottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
/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).