diff --git a/lib/nvmf/nvmf.c b/lib/nvmf/nvmf.c index 2a5ce1cae..35339ee2d 100644 --- a/lib/nvmf/nvmf.c +++ b/lib/nvmf/nvmf.c @@ -672,8 +672,12 @@ _spdk_nvmf_qpair_deactivate(void *ctx) void spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair) { - /* Send a message to the thread that owns this qpair */ - spdk_thread_send_msg(qpair->group->thread, _spdk_nvmf_qpair_deactivate, qpair); + if (qpair->group->thread == spdk_get_thread()) { + _spdk_nvmf_qpair_deactivate(qpair); + } else { + /* Send a message to the thread that owns this qpair */ + spdk_thread_send_msg(qpair->group->thread, _spdk_nvmf_qpair_deactivate, qpair); + } } int