Commit 9c04e6d8 authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

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: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Icc54b18a0bc4fae7a40e0a13846aa6ac01111c6f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16645


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent ac94b60b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -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();