Skip to contentSkip to conversation

scsi: qla2xxx: Prevent PRLI in target mode

PATCH Applied Anastasia Kovaleva 3 participants 3 messages Apr 22, 2021 – Apr 29, 2021

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

PATCH 1/1 scsi: qla2xxx: Prevent PRLI in target mode

In a case when the initiator in P2P mode by some circumstances do not send PRLI, the target, in a case when the target port’s WWPN is less than initiator’s one, changes the discovery state in DSC_GNL, and when gnl completes, it sends PRLI to the initiator.

Usually the initiator in P2P mode always sends PRLI. We catch this issue on Linux stable v5.4.6 https://www.spinics.net/lists/stable/msg458515.html

The change fixes this particular corner case in the behaviour of the P2P mod target login state machine.

Fixes a9ed06d4e640a ("scsi: qla2xxx: Allow PLOGI in target mode")
---
 drivers/scsi/qla2xxx/qla_init.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +3 -0
index f01f07116bd3..71f79c988fdc 100644
@@ -1194,6 +1194,9 @@ static int qla24xx_post_prli_work(struct scsi_qla_host *vha, fc_port_t *fcport)
 {
 	struct qla_work_evt *e;
 
+	if (vha->host->active_mode == MODE_TARGET)
+                return QLA_FUNCTION_FAILED;
+
 	e = qla2x00_alloc_work(vha, QLA_EVT_PRLI);
 	if (!e)
 		return QLA_FUNCTION_FAILED;
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 39 lines · Anastasia Kovaleva

In a case when the initiator in P2P mode by some circumstances do not send PRLI, the target, in a case when the target port’s WWPN is less than initiator’s one, changes the discovery state in DSC_GNL, and when gnl completes, it sends PRLI to the initiator.

Usually the initiator in P2P mode always sends PRLI. We catch this issue on Linux stable v5.4.6 https://www.spinics.net/lists/stable/msg458515.html

The change fixes this particular corner case in the behaviour of the P2P mod target login state machine.

Fixes a9ed06d4e640a ("scsi: qla2xxx: Allow PLOGI in target mode")

---
drivers/scsi/qla2xxx/qla_init.c | 3 +++

1 file changed, 3 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +3 -0
index f01f07116bd3..71f79c988fdc 100644
@@ -1194,6 +1194,9 @@ static int qla24xx_post_prli_work(struct scsi_qla_host *vha, fc_port_t *fcport)
 {
 	struct qla_work_evt *e;
 
+	if (vha->host->active_mode == MODE_TARGET)
+                return QLA_FUNCTION_FAILED;
+
 	e = qla2x00_alloc_work(vha, QLA_EVT_PRLI);
 	if (!e)
 		return QLA_FUNCTION_FAILED;
Signature · 1 line
2.30.2

Looks Good.

--
Himanshu Madhani Oracle Linux Engineering

#2 lore raw
In reply to Anastasia Kovaleva
Quoted 9 lines · Anastasia Kovaleva

In a case when the initiator in P2P mode by some circumstances do not send PRLI, the target, in a case when the target port’s WWPN is less than initiator’s one, changes the discovery state in DSC_GNL, and when gnl completes, it sends PRLI to the initiator.

Usually the initiator in P2P mode always sends PRLI. We catch this issue on Linux stable v5.4.6 https://www.spinics.net/lists/stable/msg458515.html

[...]

Applied to 5.13/scsi-fixes, thanks!

[1/1] scsi: qla2xxx: Prevent PRLI in target mode

      https://git.kernel.org/mkp/scsi/c/fcb16d9a8ecf
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering