All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] scsi: qla2xxx: Fix rport removal after unzoning
@ 2019-11-22 22:19 Martin Wilck
  2019-11-22 22:19 ` [PATCH 1/2] scsi: qla2xxx: fix rports not being mark as lost in sync fabric scan Martin Wilck
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Martin Wilck @ 2019-11-22 22:19 UTC (permalink / raw)
  To: Martin K. Petersen, Himanshu Madhani, Quinn Tran
  Cc: Bart Van Assche, James Bottomley, linux-scsi, Martin Wilck,
	Hannes Reinecke

From: Martin Wilck <mwilck@suse.com>

These two patches fix similar problems that occur if an initiator port
belongs only to a single zone, and this zone is removed in the fabric.
The driver doesn't notice the ports being removed, and the device nodes
persist in the host, yielding IO errors when accessed.

These are pretty old regressions, introduced before 4.16, qla2xxx
10.00.00.04-k. The "Fixes:" tags I provide are only approximate, because
the driver changed the RSCN handling in several steps.

The first patch affects only "legacy" FC adapters using synchonous
fabric scan. The second one is for newer adapters using async scanning,
and applies if the GPN_FT/GNN_FT commands sent by the adapter fail.

Martin Wilck (2):
  scsi: qla2xxx: fix rports not being mark as lost in sync fabric scan
  scsi: qla2xxx: unregister ports after GPN_FT failure

 drivers/scsi/qla2xxx/qla_gs.c   | 16 ++++++++++++++--
 drivers/scsi/qla2xxx/qla_init.c |  6 +++---
 2 files changed, 17 insertions(+), 5 deletions(-)

-- 
2.24.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] scsi: qla2xxx: fix rports not being mark as lost in sync fabric scan
  2019-11-22 22:19 [PATCH 0/2] scsi: qla2xxx: Fix rport removal after unzoning Martin Wilck
@ 2019-11-22 22:19 ` Martin Wilck
  2019-11-22 22:19 ` [PATCH 2/2] scsi: qla2xxx: unregister ports after GPN_FT failure Martin Wilck
  2019-11-27  2:34 ` [PATCH 0/2] scsi: qla2xxx: Fix rport removal after unzoning Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Wilck @ 2019-11-22 22:19 UTC (permalink / raw)
  To: Martin K. Petersen, Himanshu Madhani, Quinn Tran
  Cc: Bart Van Assche, James Bottomley, linux-scsi, Martin Wilck,
	Hannes Reinecke, David Bond

From: Martin Wilck <mwilck@suse.com>

In qla2x00_find_all_fabric_devs(), fcport->flags & FCF_LOGIN_NEEDED
is a necessary condition for logging into new rports, but not for
dropping lost ones.

Fixes: 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
Tested-by: David Bond <dbond@suse.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 drivers/scsi/qla2xxx/qla_init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 1dbee88..6c28f38 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -5898,8 +5898,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
 		if (test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags))
 			break;
 
-		if ((fcport->flags & FCF_FABRIC_DEVICE) == 0 ||
-		    (fcport->flags & FCF_LOGIN_NEEDED) == 0)
+		if ((fcport->flags & FCF_FABRIC_DEVICE) == 0)
 			continue;
 
 		if (fcport->scan_state == QLA_FCPORT_SCAN) {
@@ -5922,7 +5921,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
 			}
 		}
 
-		if (fcport->scan_state == QLA_FCPORT_FOUND)
+		if (fcport->scan_state == QLA_FCPORT_FOUND &&
+		    (fcport->flags & FCF_LOGIN_NEEDED) != 0)
 			qla24xx_fcport_handle_login(vha, fcport);
 	}
 	return (rval);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] scsi: qla2xxx: unregister ports after GPN_FT failure
  2019-11-22 22:19 [PATCH 0/2] scsi: qla2xxx: Fix rport removal after unzoning Martin Wilck
  2019-11-22 22:19 ` [PATCH 1/2] scsi: qla2xxx: fix rports not being mark as lost in sync fabric scan Martin Wilck
@ 2019-11-22 22:19 ` Martin Wilck
  2019-11-27  2:34 ` [PATCH 0/2] scsi: qla2xxx: Fix rport removal after unzoning Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Wilck @ 2019-11-22 22:19 UTC (permalink / raw)
  To: Martin K. Petersen, Himanshu Madhani, Quinn Tran
  Cc: Bart Van Assche, James Bottomley, linux-scsi, Martin Wilck,
	Hannes Reinecke, Jason Orendorf

From: Martin Wilck <mwilck@suse.com>

When ports are lost due to unzoning them, and the initiator port
is not part of any more zones, the GPN_FT command used for the
fabric scan may fail. In this case, the current code simply gives
up after a few retries. But if the zone is gone, all rports should
actually be marked as lost.

Fix this by jumping to the code that handles logout after GNN_FT
after scan retries are exhausted.

Fixes: f352eeb75419 ("scsi: qla2xxx: Add ability to use GPNFT/GNNFT for RSCN handling")
Tested-by: Jason Orendorf <orendorf@hpe.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 drivers/scsi/qla2xxx/qla_gs.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 6723068..446a9d6 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -3587,12 +3587,23 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
 		if (vha->scan.scan_retry < MAX_SCAN_RETRIES) {
 			set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
 			set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
+			goto out;
 		} else {
-			ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0xffff,
+			ql_dbg(ql_dbg_disc, vha, 0xffff,
 			    "%s: Fabric scan failed for %d retries.\n",
 			    __func__, vha->scan.scan_retry);
+			/*
+			 * Unable to scan any rports. logout loop below
+			 * will unregister all sessions.
+			 */
+			list_for_each_entry(fcport, &vha->vp_fcports, list) {
+				if ((fcport->flags & FCF_FABRIC_DEVICE) != 0) {
+					fcport->scan_state = QLA_FCPORT_SCAN;
+					fcport->logout_on_delete = 0;
+				}
+			}
+			goto login_logout;
 		}
-		goto out;
 	}
 	vha->scan.scan_retry = 0;
 
@@ -3670,6 +3681,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp)
 		    dup_cnt);
 	}
 
+login_logout:
 	/*
 	 * Logout all previous fabric dev marked lost, except FCP2 devices.
 	 */
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] scsi: qla2xxx: Fix rport removal after unzoning
  2019-11-22 22:19 [PATCH 0/2] scsi: qla2xxx: Fix rport removal after unzoning Martin Wilck
  2019-11-22 22:19 ` [PATCH 1/2] scsi: qla2xxx: fix rports not being mark as lost in sync fabric scan Martin Wilck
  2019-11-22 22:19 ` [PATCH 2/2] scsi: qla2xxx: unregister ports after GPN_FT failure Martin Wilck
@ 2019-11-27  2:34 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2019-11-27  2:34 UTC (permalink / raw)
  To: Martin Wilck
  Cc: Martin K. Petersen, Himanshu Madhani, Quinn Tran,
	Bart Van Assche, James Bottomley, linux-scsi, Hannes Reinecke


Martin,

> These two patches fix similar problems that occur if an initiator port
> belongs only to a single zone, and this zone is removed in the fabric.
> The driver doesn't notice the ports being removed, and the device
> nodes persist in the host, yielding IO errors when accessed.

Applied to 5.5/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-27  2:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 22:19 [PATCH 0/2] scsi: qla2xxx: Fix rport removal after unzoning Martin Wilck
2019-11-22 22:19 ` [PATCH 1/2] scsi: qla2xxx: fix rports not being mark as lost in sync fabric scan Martin Wilck
2019-11-22 22:19 ` [PATCH 2/2] scsi: qla2xxx: unregister ports after GPN_FT failure Martin Wilck
2019-11-27  2:34 ` [PATCH 0/2] scsi: qla2xxx: Fix rport removal after unzoning Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.