Blame SOURCES/0103-scsi-scsi-qla2xxx-on-session-delete-return-nvme-cmd.patch

3c6e85
From c1cee792ace4dc1d66b236b14881e2f3d34da1db Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 1 Aug 2019 15:56:03 -0400
3c6e85
Subject: [PATCH 103/124] [scsi] scsi: qla2xxx: on session delete, return nvme
3c6e85
 cmd
3c6e85
3c6e85
Message-id: <20190801155618.12650-104-hmadhani@redhat.com>
3c6e85
Patchwork-id: 267886
3c6e85
O-Subject: [RHEL 7.8 e-stor PATCH 103/118] scsi: qla2xxx: on session delete, return nvme cmd
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 delete or chip reset, reject all NVME commands.
3c6e85
3c6e85
 - on NVME command submission error, free srb resource.
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 2eb9238affa72a5260b14388cf56598f7413109b)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_nvme.c | 28 +++++++++++++++++++---------
3c6e85
 1 file changed, 19 insertions(+), 9 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
3c6e85
index 494082a6f8ed..d6b36a9e9917 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_nvme.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
3c6e85
@@ -239,8 +239,16 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
3c6e85
 	struct qla_hw_data *ha;
3c6e85
 	srb_t           *sp;
3c6e85
 
3c6e85
+
3c6e85
+	if (!fcport || (fcport && fcport->deleted))
3c6e85
+		return rval;
3c6e85
+
3c6e85
 	vha = fcport->vha;
3c6e85
 	ha = vha->hw;
3c6e85
+
3c6e85
+	if (!ha->flags.fw_started)
3c6e85
+		return rval;
3c6e85
+
3c6e85
 	/* Alloc SRB structure */
3c6e85
 	sp = qla2x00_get_sp(vha, fcport, GFP_ATOMIC);
3c6e85
 	if (!sp)
3c6e85
@@ -272,6 +280,7 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
3c6e85
 		    "qla2x00_start_sp failed = %d\n", rval);
3c6e85
 		atomic_dec(&sp->ref_count);
3c6e85
 		wake_up(&sp->nvme_ls_waitq);
3c6e85
+		sp->free(sp);
3c6e85
 		return rval;
3c6e85
 	}
3c6e85
 
3c6e85
@@ -503,11 +512,11 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
3c6e85
 
3c6e85
 	fcport = qla_rport->fcport;
3c6e85
 
3c6e85
-	vha = fcport->vha;
3c6e85
-
3c6e85
-	if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags))
3c6e85
+	if (!qpair || !fcport || (qpair && !qpair->fw_started) ||
3c6e85
+	    (fcport && fcport->deleted))
3c6e85
 		return rval;
3c6e85
 
3c6e85
+	vha = fcport->vha;
3c6e85
 	/*
3c6e85
 	 * If we know the dev is going away while the transport is still sending
3c6e85
 	 * IO's return busy back to stall the IO Q.  This happens when the
3c6e85
@@ -540,6 +549,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
3c6e85
 		    "qla2x00_start_nvme_mq failed = %d\n", rval);
3c6e85
 		atomic_dec(&sp->ref_count);
3c6e85
 		wake_up(&sp->nvme_ls_waitq);
3c6e85
+		sp->free(sp);
3c6e85
 	}
3c6e85
 
3c6e85
 	return rval;
3c6e85
@@ -566,14 +576,13 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport)
3c6e85
 
3c6e85
 	complete(&fcport->nvme_del_done);
3c6e85
 
3c6e85
-	if (!test_bit(UNLOADING, &fcport->vha->dpc_flags)) {
3c6e85
-		INIT_WORK(&fcport->free_work, qlt_free_session_done);
3c6e85
-		schedule_work(&fcport->free_work);
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 completed.\n", fcport);
3c6e85
+	    "remoteport_delete of %p %8phN completed.\n",
3c6e85
+	    fcport, fcport->port_name);
3c6e85
 }
3c6e85
 
3c6e85
 static struct nvme_fc_port_template qla_nvme_fc_transport = {
3c6e85
@@ -606,7 +615,8 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work)
3c6e85
 		return;
3c6e85
 
3c6e85
 	ql_log(ql_log_warn, NULL, 0x2112,
3c6e85
-	    "%s: unregister remoteport on %p\n",__func__, fcport);
3c6e85
+	    "%s: unregister remoteport on %p %8phN\n",
3c6e85
+	    __func__, fcport, fcport->port_name);
3c6e85
 
3c6e85
 	nvme_fc_set_remoteport_devloss(fcport->nvme_remote_port, 0);
3c6e85
 	init_completion(&fcport->nvme_del_done);
3c6e85
-- 
3c6e85
2.13.6
3c6e85