From 1a6d59334528f910c3321ed3f52c7803caee29b9 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Thu, 14 Jun 2018 10:42:19 -0700 Subject: [PATCH] nvmf: Only send message on qpair disconnect if on wrong thread Change-Id: I5297c7a869402c96f69d705a13529c32296a9eaa Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/415314 Tested-by: SPDK Automated Test System Reviewed-by: Changpeng Liu Reviewed-by: Daniel Verkamp --- lib/nvmf/nvmf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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