From 1e2c9afa9539334a304546e716ac80e4f62c4b22 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Thu, 19 Jul 2018 15:50:34 -0700 Subject: [PATCH] nvmf: always call qpair_delete cb on original thread This ensures that when we continue to iterate through channels after deleting the qpair, we will be able to continue iterating through channels. Change-Id: I6fba43dc14a3e5e8faac78f8b37e9e0c6aad2687 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/419920 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Ziye Yang Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/nvmf/nvmf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/nvmf/nvmf.c b/lib/nvmf/nvmf.c index 8aa2d3a74a..7aedb03096 100644 --- a/lib/nvmf/nvmf.c +++ b/lib/nvmf/nvmf.c @@ -60,6 +60,7 @@ struct nvmf_qpair_disconnect_ctx { struct spdk_nvmf_qpair *qpair; struct spdk_nvmf_ctrlr *ctrlr; nvmf_qpair_disconnect_cb cb_fn; + struct spdk_thread *thread; void *ctx; }; @@ -616,7 +617,7 @@ _spdk_nvmf_ctrlr_free_from_qpair(void *ctx) spdk_nvmf_ctrlr_destruct(ctrlr); if (qpair_ctx->cb_fn) { - qpair_ctx->cb_fn(qpair_ctx->ctx); + spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx); } free(qpair_ctx); } @@ -639,7 +640,7 @@ _spdk_nvmf_qpair_destroy(void *ctx, int status) if (!ctrlr) { if (qpair_ctx->cb_fn) { - qpair_ctx->cb_fn(qpair_ctx->ctx); + spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx); } free(qpair_ctx); return; @@ -657,7 +658,7 @@ _spdk_nvmf_qpair_destroy(void *ctx, int status) spdk_thread_send_msg(ctrlr->subsys->thread, _spdk_nvmf_ctrlr_free_from_qpair, qpair_ctx); } else { if (qpair_ctx->cb_fn) { - qpair_ctx->cb_fn(qpair_ctx->ctx); + spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx); } free(qpair_ctx); } @@ -675,7 +676,7 @@ _spdk_nvmf_qpair_deactivate(void *ctx) * which results in a notification that the connection * died. */ if (qpair_ctx->cb_fn) { - qpair_ctx->cb_fn(qpair_ctx->ctx); + spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx); } free(qpair_ctx); return; @@ -707,6 +708,7 @@ spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_ qpair_ctx->qpair = qpair; qpair_ctx->cb_fn = cb_fn; + qpair_ctx->thread = qpair->group->thread; qpair_ctx->ctx = ctx; if (qpair->group->thread == spdk_get_thread()) {