Skip to contentSkip to conversation

qla2xxx: Set disable_target_scan=1 when initiator-mode is disabled

PATCH New Nicholas A. Bellinger 1 participant 1 message Feb 16, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qla2xxx: Set disable_target_scan=1 when initiator-mode is disabled

From: Nicholas Bellinger <[email protected]>

This patch sets fc_function_template->disable_target_scan=1 with qla2xxx_transport_functions + qla2xxx_transport_vport_functions during qla2x00_module_init() when qla_target.c init code is explictly asking to disable initiator-mode for all ports with QLA2XXX_INI_MODE_DISABLED.

This fixes a bug where a FC fabric LOOP UP event causes an initiator-mode LUN SCAN to occur via scsi_transport_fc.:fc_scsi_scan_rport() -> scsi_scan_target() before tcm_qla2xxx ports are configured -> enabled to run in target-mode.

This ends up causing SCSI layer timeouts during normal tcm_qla2xxx port setup w/ ISP reset, so go ahead and explictly set disable_target_scan=1 during init to prevent this from occuring.

Cc Ben Lairson <[email protected]>
Cc Roland Dreier <[email protected]>
Cc Arun Easi <[email protected]>
Cc Andrew Vasquez <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc James Bottomley <[email protected]>
---
 drivers/scsi/qla2xxx/qla_os.c     |    8 ++++++++
 drivers/scsi/qla2xxx/qla_target.c |    6 ++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +8 -0
index 3db960b..8b08bec 100644
@@ -4405,6 +4405,14 @@ qla2x00_module_init(void)
 	if (ret < 0) {
 		kmem_cache_destroy(srb_cachep);
 		return ret;
+	} else if (ret > 0) {
+		/*
+		 * If initiator mode is explictly disabled by qla_tgt_init(),
+		 * prevent scsi_transport_fc.c:fc_scsi_scan_rport() from
+		 * performing scsi_scan_target() during LOOP UP event.
+		 */
+		qla2xxx_transport_functions.disable_target_scan = 1;
+		qla2xxx_transport_vport_functions.disable_target_scan = 1;
 	}
 
 	/* Derive version string. */
drivers/scsi/qla2xxx/qla_target.c +4 -2
index ac203ef..9282014 100644
@@ -4753,8 +4753,10 @@ int __init qla_tgt_init(void)
 		ret = -ENOMEM;
 		goto out_cmd_mempool;
 	}
-
-	return 0;
+	/*
+	 * Return 1 to signal that initiator-mode is being disabled
+	 */
+	return (ql2x_ini_mode == QLA2XXX_INI_MODE_DISABLED) ? 1 : 0;
 
 out_cmd_mempool:
 	mempool_destroy(qla_tgt_mgmt_cmd_mempool);
Signature · 1 line
1.7.2.5