From 4a670845f8541761c10fd33eb983c154ed4ba33c Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Wed, 21 Jul 2021 20:36:24 +0800 Subject: [PATCH] idxd: Add a check for the batches list. This assert is used to make sure that there is no active batch (spdk_accel_batch) task is used. If there are active batches found, it means that we did not handle this case in a good manner. Signed-off-by: Ziye Yang Change-Id: I7ea6247d2d5a40cf4f3f31cd8b1240fed4648d62 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8857 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Reviewed-by: Ben Walker Reviewed-by: Paul Luse Reviewed-by: Krzysztof Karas Reviewed-by: Aleksey Marchuk --- lib/idxd/idxd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index dc7811b78..a2dc11c1b 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -144,11 +144,14 @@ spdk_idxd_put_channel(struct spdk_idxd_io_channel *chan) { struct idxd_batch *batch; + assert(chan != NULL); + pthread_mutex_lock(&chan->idxd->num_channels_lock); assert(chan->idxd->num_channels > 0); chan->idxd->num_channels--; pthread_mutex_unlock(&chan->idxd->num_channels_lock); + assert(TAILQ_EMPTY(&chan->batches)); spdk_free(chan->completions); spdk_free(chan->desc); spdk_bit_array_free(&chan->ring_slots);