nvmet-fc: do not check for invalid target port in nvmet_fc_handle_fcp_rqst()
authorHannes Reinecke <hare@suse.de>
Tue, 25 May 2021 12:54:14 +0000 (14:54 +0200)
committerChristoph Hellwig <hch@lst.de>
Thu, 17 Jun 2021 13:51:19 +0000 (15:51 +0200)
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>
Reviewed-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/fc.c

index 19e113240fff91ce9d17b6e1ffa2254eaa13b650..22b5108168a6a2d2bfd62b047aaf5c2cb9522e53 100644 (file)
@@ -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));