From d5b7f3c580c721669687357b4f079369287fa755 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Mon, 26 Apr 2021 12:08:59 +0900 Subject: [PATCH] thread: Add check if the correct thread called spdk_poller_pause/resume() Signed-off-by: Shuhei Matsumoto Change-Id: Ie2156a331bc2384a1cebe66fcddb90ef5aa1c380 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7661 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker Reviewed-by: Jim Harris Reviewed-by: Konrad Sztyber Reviewed-by: Aleksey Marchuk Reviewed-by: --- lib/thread/thread.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/thread/thread.c b/lib/thread/thread.c index 4c4b5da5a..c42b77903 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -1355,6 +1355,12 @@ spdk_poller_pause(struct spdk_poller *poller) return; } + if (poller->thread != thread) { + SPDK_ERRLOG("different from the thread that called spdk_poller_pause()\n"); + assert(false); + return; + } + /* If a poller is paused from within itself, we can immediately move it * on the paused_pollers list. Otherwise we just set its state to * SPDK_POLLER_STATE_PAUSING and let spdk_thread_poll() move it. It @@ -1391,6 +1397,12 @@ spdk_poller_resume(struct spdk_poller *poller) return; } + if (poller->thread != thread) { + SPDK_ERRLOG("different from the thread that called spdk_poller_resume()\n"); + assert(false); + return; + } + /* If a poller is paused it has to be removed from the paused pollers * list and put on the active / timer list depending on its * period_ticks. If a poller is still in the process of being paused,