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: Ziye Yang <ziye.yang@intel.com> Reviewed-on: https://review.gerrithub.io/c/444147 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
0c93fc7330
commit
1b8cbebf1c
@ -1865,7 +1865,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (g_num_namespaces == 0) {
|
if (g_num_namespaces == 0) {
|
||||||
fprintf(stderr, "No valid NVMe controllers or AIO devices found\n");
|
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);
|
rc = pthread_create(&thread_id, NULL, &nvme_poll_ctrlrs, NULL);
|
||||||
@ -1903,7 +1903,7 @@ int main(int argc, char **argv)
|
|||||||
print_stats();
|
print_stats();
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (pthread_cancel(thread_id) == 0) {
|
if (thread_id && pthread_cancel(thread_id) == 0) {
|
||||||
pthread_join(thread_id, NULL);
|
pthread_join(thread_id, NULL);
|
||||||
}
|
}
|
||||||
unregister_trids();
|
unregister_trids();
|
||||||
|
Loading…
Reference in New Issue
Block a user