summaryrefslogtreecommitdiff
path: root/drivers/nvme/target/fcloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nvme/target/fcloop.c')
-rw-r--r--drivers/nvme/target/fcloop.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c
index 866048f07e61..b63af3b643a6 100644
--- a/drivers/nvme/target/fcloop.c
+++ b/drivers/nvme/target/fcloop.c
@@ -491,6 +491,7 @@ fcloop_t2h_xmt_ls_rsp(struct nvme_fc_local_port *localport,
struct fcloop_rport *rport = remoteport->private;
struct nvmet_fc_target_port *targetport = rport->targetport;
struct fcloop_tport *tport;
+ int ret = 0;
if (!targetport) {
/*
@@ -500,12 +501,18 @@ fcloop_t2h_xmt_ls_rsp(struct nvme_fc_local_port *localport,
* We end up here from delete association exchange:
* nvmet_fc_xmt_disconnect_assoc sends an async request.
*
- * Return success because this is what LLDDs do; silently
- * drop the response.
+ * Return success when remoteport is still online because this
+ * is what LLDDs do and silently drop the response. Otherwise,
+ * return with error to signal upper layer to perform the lsrsp
+ * resource cleanup.
*/
- lsrsp->done(lsrsp);
+ if (remoteport->port_state == FC_OBJSTATE_ONLINE)
+ lsrsp->done(lsrsp);
+ else
+ ret = -ENODEV;
+
kmem_cache_free(lsreq_cache, tls_req);
- return 0;
+ return ret;
}
memcpy(lsreq->rspaddr, lsrsp->rspbuf,