Blame SOURCES/0105-scsi-scsi-qla2xxx-move-IO-flush-to-the-front-of-NVME.patch

3c6e85
From d2bb1b2d6d650c7a447e283b45a55015e560bc1b Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 1 Aug 2019 15:56:05 -0400
3c6e85
Subject: [PATCH 105/124] [scsi] scsi: qla2xxx: move IO flush to the front of
3c6e85
 NVME rport unregistration
3c6e85
3c6e85
Message-id: <20190801155618.12650-106-hmadhani@redhat.com>
3c6e85
Patchwork-id: 267888
3c6e85
O-Subject: [RHEL 7.8 e-stor PATCH 105/118] scsi: qla2xxx: move IO flush to the front of NVME rport unregistration
3c6e85
Bugzilla: 1729270
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
3c6e85
From: Quinn Tran <qutran@marvell.com>
3c6e85
3c6e85
Bugzilla 1729270
3c6e85
3c6e85
On session deletion, current qla code would unregister an NVMe session
3c6e85
before flushing IOs. This patch would move the unregistration of NVMe
3c6e85
session after IO flush. This way FC-NVMe layer would not have to wait for
3c6e85
stuck IOs. In addition, qla2xxx would stop accepting new IOs during session
3c6e85
deletion.
3c6e85
3c6e85
Signed-off-by: Quinn Tran <qutran@marvell.com>
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3c6e85
(cherry picked from commit baf23eddbf2a4ba9bf2bdb342686c71a8042e39b)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_def.h    |  1 -
3c6e85
 drivers/scsi/qla2xxx/qla_gbl.h    |  2 ++
3c6e85
 drivers/scsi/qla2xxx/qla_nvme.c   | 14 ++------------
3c6e85
 drivers/scsi/qla2xxx/qla_target.c | 16 ++++++++--------
3c6e85
 4 files changed, 12 insertions(+), 21 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
3c6e85
index b3c10c0f24c7..4c82d210c95d 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_def.h
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_def.h
3c6e85
@@ -2378,7 +2378,6 @@ typedef struct fc_port {
3c6e85
 	unsigned int id_changed:1;
3c6e85
 	unsigned int scan_needed:1;
3c6e85
 
3c6e85
-	struct work_struct nvme_del_work;
3c6e85
 	struct completion nvme_del_done;
3c6e85
 	uint32_t nvme_prli_service_param;
3c6e85
 #define NVME_PRLI_SP_CONF       BIT_7
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
3c6e85
index 27193f858ca2..5075d447c69e 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_gbl.h
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
3c6e85
@@ -906,4 +906,6 @@ void qlt_remove_target_resources(struct qla_hw_data *);
3c6e85
 void qlt_set_mode(struct scsi_qla_host *);
3c6e85
 int qla2x00_set_data_rate(scsi_qla_host_t *vha, uint16_t mode);
3c6e85
 
3c6e85
+/* nvme.c */
3c6e85
+void qla_nvme_unregister_remote_port(struct fc_port *fcport);
3c6e85
 #endif /* _QLA_GBL_H */
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
3c6e85
index 081320afaab4..74fbe38eaae2 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_nvme.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
3c6e85
@@ -12,8 +12,6 @@
3c6e85
 
3c6e85
 static struct nvme_fc_port_template qla_nvme_fc_transport;
3c6e85
 
3c6e85
-static void qla_nvme_unregister_remote_port(struct work_struct *);
3c6e85
-
3c6e85
 int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport)
3c6e85
 {
3c6e85
 	struct qla_nvme_rport *rport;
3c6e85
@@ -38,7 +36,6 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport)
3c6e85
 		(fcport->nvme_flag & NVME_FLAG_REGISTERED))
3c6e85
 		return 0;
3c6e85
 
3c6e85
-	INIT_WORK(&fcport->nvme_del_work, qla_nvme_unregister_remote_port);
3c6e85
 	fcport->nvme_flag &= ~NVME_FLAG_RESETTING;
3c6e85
 
3c6e85
 	memset(&req, 0, sizeof(struct nvme_fc_port_info));
3c6e85
@@ -636,16 +633,11 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport)
3c6e85
 	fcport = qla_rport->fcport;
3c6e85
 	fcport->nvme_remote_port = NULL;
3c6e85
 	fcport->nvme_flag &= ~NVME_FLAG_REGISTERED;
3c6e85
-
3c6e85
-	complete(&fcport->nvme_del_done);
3c6e85
-
3c6e85
-	INIT_WORK(&fcport->free_work, qlt_free_session_done);
3c6e85
-	schedule_work(&fcport->free_work);
3c6e85
-
3c6e85
 	fcport->nvme_flag &= ~NVME_FLAG_DELETING;
3c6e85
 	ql_log(ql_log_info, fcport->vha, 0x2110,
3c6e85
 	    "remoteport_delete of %p %8phN completed.\n",
3c6e85
 	    fcport, fcport->port_name);
3c6e85
+	complete(&fcport->nvme_del_done);
3c6e85
 }
3c6e85
 
3c6e85
 static struct nvme_fc_port_template qla_nvme_fc_transport = {
3c6e85
@@ -668,10 +660,8 @@ static struct nvme_fc_port_template qla_nvme_fc_transport = {
3c6e85
 	.fcprqst_priv_sz = sizeof(struct nvme_private),
3c6e85
 };
3c6e85
 
3c6e85
-static void qla_nvme_unregister_remote_port(struct work_struct *work)
3c6e85
+void qla_nvme_unregister_remote_port(struct fc_port *fcport)
3c6e85
 {
3c6e85
-	struct fc_port *fcport = container_of(work, struct fc_port,
3c6e85
-	    nvme_del_work);
3c6e85
 	int ret;
3c6e85
 
3c6e85
 	if (!IS_ENABLED(CONFIG_NVME_FC))
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
3c6e85
index f79b51fcbca3..9e16a97f8fcb 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_target.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_target.c
3c6e85
@@ -1012,6 +1012,12 @@ void qlt_free_session_done(struct work_struct *work)
3c6e85
 				else
3c6e85
 					logout_started = true;
3c6e85
 			}
3c6e85
+		} /* if sess->logout_on_delete */
3c6e85
+
3c6e85
+		if (sess->nvme_flag & NVME_FLAG_REGISTERED &&
3c6e85
+		    !(sess->nvme_flag & NVME_FLAG_DELETING)) {
3c6e85
+			sess->nvme_flag |= NVME_FLAG_DELETING;
3c6e85
+			qla_nvme_unregister_remote_port(sess);
3c6e85
 		}
3c6e85
 	}
3c6e85
 
3c6e85
@@ -1163,14 +1169,8 @@ void qlt_unreg_sess(struct fc_port *sess)
3c6e85
 	sess->last_rscn_gen = sess->rscn_gen;
3c6e85
 	sess->last_login_gen = sess->login_gen;
3c6e85
 
3c6e85
-	if (sess->nvme_flag & NVME_FLAG_REGISTERED &&
3c6e85
-	    !(sess->nvme_flag & NVME_FLAG_DELETING)) {
3c6e85
-		sess->nvme_flag |= NVME_FLAG_DELETING;
3c6e85
-		schedule_work(&sess->nvme_del_work);
3c6e85
-	} else {
3c6e85
-		INIT_WORK(&sess->free_work, qlt_free_session_done);
3c6e85
-		schedule_work(&sess->free_work);
3c6e85
-	}
3c6e85
+	INIT_WORK(&sess->free_work, qlt_free_session_done);
3c6e85
+	schedule_work(&sess->free_work);
3c6e85
 }
3c6e85
 EXPORT_SYMBOL(qlt_unreg_sess);
3c6e85
 
3c6e85
-- 
3c6e85
2.13.6
3c6e85