From 9c04e6d832c0fc9267463de40a4a89381dc7f36d Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Thu, 26 Jan 2023 16:33:04 +0100 Subject: [PATCH] examples/abort: check status of all workers Previously, we only cared about the status of the main worker thread and ignored errors from other threads. This patch changes that and now it'll return an error if any of the worker threads encountered an error. Signed-off-by: Konrad Sztyber Change-Id: Icc54b18a0bc4fae7a40e0a13846aa6ac01111c6f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16645 Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk --- examples/nvme/abort/abort.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/nvme/abort/abort.c b/examples/nvme/abort/abort.c index cfa84ec8f..ea75a9f2f 100644 --- a/examples/nvme/abort/abort.c +++ b/examples/nvme/abort/abort.c @@ -70,6 +70,7 @@ struct worker_thread { TAILQ_HEAD(, ctrlr_worker_ctx) ctrlr_ctx; TAILQ_ENTRY(worker_thread) link; unsigned lcore; + int status; }; static const char *g_workload_type = "read"; @@ -435,6 +436,7 @@ work_fn(void *arg) ns_ctx->qpair = spdk_nvme_ctrlr_alloc_io_qpair(ns_entry->ctrlr, &opts, sizeof(opts)); if (ns_ctx->qpair == NULL) { fprintf(stderr, "spdk_nvme_ctrlr_alloc_io_qpair failed\n"); + worker->status = -ENOMEM; return 1; } } @@ -1101,6 +1103,13 @@ main(int argc, char **argv) spdk_env_thread_wait_all(); + TAILQ_FOREACH(worker, &g_workers, link) { + if (worker->status != 0) { + rc = 1; + break; + } + } + cleanup: unregister_trids(); unregister_workers();