Commit 1b8cbebf authored by Ziye Yang's avatar Ziye Yang Committed by Jim Harris
Browse files

nvme/perf: fix the core dump issue.



If spdk_nvme_probe fails, there will be no controller,
and we jump to clean up. And the thread is not created,
so we need to judge the value of thread. if it is not zero,
we will do the pthread_cancel. Otherwise, we do not
need to call that. If we call that, it will have coredump.

btw: we also fix an small issue of cleanup.

Change-Id: Iee854f6ef42ef6d4a3d3f63d57740375e293a3ba
Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/444147


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 0c93fc73
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1865,7 +1865,7 @@ int main(int argc, char **argv)

	if (g_num_namespaces == 0) {
		fprintf(stderr, "No valid NVMe controllers or AIO devices found\n");
		return 0;
		goto cleanup;
	}

	rc = pthread_create(&thread_id, NULL, &nvme_poll_ctrlrs, NULL);
@@ -1903,7 +1903,7 @@ int main(int argc, char **argv)
	print_stats();

cleanup:
	if (pthread_cancel(thread_id) == 0) {
	if (thread_id && pthread_cancel(thread_id) == 0) {
		pthread_join(thread_id, NULL);
	}
	unregister_trids();