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 <konrad.sztyber@intel.com>
Change-Id: Icc54b18a0bc4fae7a40e0a13846aa6ac01111c6f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16645
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Konrad Sztyber 2023-01-26 16:33:04 +01:00 committed by Tomasz Zawadzki
parent ac94b60b54
commit 9c04e6d832

View File

@ -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();