target-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: Prevent PRLI in target mode
@ 2021-04-22 15:34 Anastasia Kovaleva
  2021-04-22 17:06 ` Himanshu Madhani
  2021-04-29  3:18 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Anastasia Kovaleva @ 2021-04-22 15:34 UTC (permalink / raw)
  To: target-devel; +Cc: linux-scsi, linux, Anastasia Kovaleva, Roman Bolshakov

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")
Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com>
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 drivers/scsi/qla2xxx/qla_init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index f01f07116bd3..71f79c988fdc 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -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;
-- 
2.30.2


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

* Re: [PATCH] scsi: qla2xxx: Prevent PRLI in target mode
  2021-04-22 15:34 [PATCH] scsi: qla2xxx: Prevent PRLI in target mode Anastasia Kovaleva
@ 2021-04-22 17:06 ` Himanshu Madhani
  2021-04-29  3:18 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Himanshu Madhani @ 2021-04-22 17:06 UTC (permalink / raw)
  To: Anastasia Kovaleva; +Cc: target-devel, linux-scsi, linux, Roman Bolshakov



> On Apr 22, 2021, at 10:34 AM, Anastasia Kovaleva <a.kovaleva@yadro.com> wrote:
> 
> 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")
> Signed-off-by: Anastasia Kovaleva <a.kovaleva@yadro.com>
> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
> drivers/scsi/qla2xxx/qla_init.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index f01f07116bd3..71f79c988fdc 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -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;
> -- 
> 2.30.2
> 

Looks Good. 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering


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

* Re: [PATCH] scsi: qla2xxx: Prevent PRLI in target mode
  2021-04-22 15:34 [PATCH] scsi: qla2xxx: Prevent PRLI in target mode Anastasia Kovaleva
  2021-04-22 17:06 ` Himanshu Madhani
@ 2021-04-29  3:18 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-04-29  3:18 UTC (permalink / raw)
  To: Anastasia Kovaleva, target-devel
  Cc: Martin K . Petersen, linux, Roman Bolshakov, linux-scsi

On Thu, 22 Apr 2021 18:34:14 +0300, Anastasia Kovaleva wrote:

> 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

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-04-29  3:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 15:34 [PATCH] scsi: qla2xxx: Prevent PRLI in target mode Anastasia Kovaleva
2021-04-22 17:06 ` Himanshu Madhani
2021-04-29  3:18 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).