Skip to content

Commit 8b25f35

Browse files
jsmart-ghChristoph Hellwig
authored andcommitted
nvme-fc: address target disconnect race conditions in fcp io submit
There are cases where threads are in the process of submitting new io when the LLDD calls in to remove the remote port. In some cases, the next io actually goes to the LLDD, who knows the remoteport isn't present and rejects it. To properly recovery/restart these i/o's we don't want to hard fail them, we want to treat them as temporary resource errors in which a delayed retry will work. Add a couple more checks on remoteport connectivity and commonize the busy response handling when it's seen. Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 2fd4167 commit 8b25f35

File tree

1 file changed

+11
-8
lines changed
  • drivers/nvme/host

1 file changed

+11
-8
lines changed

drivers/nvme/host/fc.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,7 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
18881888
* the target device is present
18891889
*/
18901890
if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
1891-
return BLK_STS_IOERR;
1891+
goto busy;
18921892

18931893
if (!nvme_fc_ctrl_get(ctrl))
18941894
return BLK_STS_IOERR;
@@ -1958,22 +1958,25 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
19581958
queue->lldd_handle, &op->fcp_req);
19591959

19601960
if (ret) {
1961-
if (op->rq) /* normal request */
1961+
if (!(op->flags & FCOP_FLAGS_AEN))
19621962
nvme_fc_unmap_data(ctrl, op->rq, op);
1963-
/* else - aen. no cleanup needed */
19641963

19651964
nvme_fc_ctrl_put(ctrl);
19661965

1967-
if (ret != -EBUSY)
1966+
if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE &&
1967+
ret != -EBUSY)
19681968
return BLK_STS_IOERR;
19691969

1970-
if (op->rq)
1971-
blk_mq_delay_run_hw_queue(queue->hctx, NVMEFC_QUEUE_DELAY);
1972-
1973-
return BLK_STS_RESOURCE;
1970+
goto busy;
19741971
}
19751972

19761973
return BLK_STS_OK;
1974+
1975+
busy:
1976+
if (!(op->flags & FCOP_FLAGS_AEN) && queue->hctx)
1977+
blk_mq_delay_run_hw_queue(queue->hctx, NVMEFC_QUEUE_DELAY);
1978+
1979+
return BLK_STS_RESOURCE;
19771980
}
19781981

19791982
static blk_status_t

0 commit comments

Comments
 (0)