All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet/fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst()
@ 2021-05-25 12:54 Hannes Reinecke
  2021-06-03 23:52 ` James Smart
  2021-06-08 16:43 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Hannes Reinecke @ 2021-05-25 12:54 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Sagi Grimberg, Keith Busch, James Smart, linux-nvme, Hannes Reinecke

When parsing a request in nvmet_fc_handle_fcp_rqst() we should not
check for invalid target ports; if we do the command is aborted
from the fcp layer, causing the host to assume a transport error.
Rather we should still forward this request to the nvmet layer, which
will then correctly fail the command with an appropriate error status.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/nvme/target/fc.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index 19e113240fff..22b5108168a6 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -2510,13 +2510,6 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
 	u32 xfrlen = be32_to_cpu(cmdiu->data_len);
 	int ret;
 
-	/*
-	 * if there is no nvmet mapping to the targetport there
-	 * shouldn't be requests. just terminate them.
-	 */
-	if (!tgtport->pe)
-		goto transport_error;
-
 	/*
 	 * Fused commands are currently not supported in the linux
 	 * implementation.
@@ -2544,7 +2537,8 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
 
 	fod->req.cmd = &fod->cmdiubuf.sqe;
 	fod->req.cqe = &fod->rspiubuf.cqe;
-	fod->req.port = tgtport->pe->port;
+	if (tgtport->pe)
+		fod->req.port = tgtport->pe->port;
 
 	/* clear any response payload */
 	memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf));
-- 
2.26.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvmet/fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst()
  2021-05-25 12:54 [PATCH] nvmet/fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst() Hannes Reinecke
@ 2021-06-03 23:52 ` James Smart
  2021-06-08 16:43 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: James Smart @ 2021-06-03 23:52 UTC (permalink / raw)
  To: linux-nvme

On 5/25/2021 5:54 AM, Hannes Reinecke wrote:
> When parsing a request in nvmet_fc_handle_fcp_rqst() we should not
> check for invalid target ports; if we do the command is aborted
> from the fcp layer, causing the host to assume a transport error.
> Rather we should still forward this request to the nvmet layer, which
> will then correctly fail the command with an appropriate error status.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>

Well, correct behavior either way as I to would think it is a transport 
error if the port hasn't been tied to any subsystem yet.  But, I guess 
it's fine to let nvmet_find_get_subsys() see the null port pointer and 
fail Connect with INVALID_PARAM|DNR as well.

so - ok

Reviewed-by: James Smart <jsmart2021@gmail.com>

-- james


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvmet/fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst()
  2021-05-25 12:54 [PATCH] nvmet/fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst() Hannes Reinecke
  2021-06-03 23:52 ` James Smart
@ 2021-06-08 16:43 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-06-08 16:43 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Sagi Grimberg, Keith Busch, James Smart, linux-nvme

Thanks,

applied to nvme-5.14.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2021-06-08 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 12:54 [PATCH] nvmet/fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst() Hannes Reinecke
2021-06-03 23:52 ` James Smart
2021-06-08 16:43 ` Christoph Hellwig

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.