fio/nvme: Fix segfault upon fio completion.

Cancel the thread polling admin completions only after
all of the individual fio threads have been cleaned up.

Change-Id: I6ddedf043664073631f2161d3969ae743323003b
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/420575
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Lance Hartmann 2018-07-26 13:19:41 -04:00 committed by Ben Walker
parent 2a55d70387
commit ef468ff71b

View File

@ -820,14 +820,11 @@ static void spdk_fio_cleanup(struct thread_data *td)
free(fio_thread);
if (pthread_cancel(g_ctrlr_thread_id) == 0) {
pthread_join(g_ctrlr_thread_id, NULL);
}
pthread_mutex_lock(&mutex);
td_count--;
if (td_count == 0) {
struct spdk_fio_ctrlr *fio_ctrlr, *fio_ctrlr_tmp;
fio_ctrlr = ctrlr_g;
while (fio_ctrlr != NULL) {
spdk_nvme_detach(fio_ctrlr->ctrlr);
@ -835,8 +832,14 @@ static void spdk_fio_cleanup(struct thread_data *td)
free(fio_ctrlr);
fio_ctrlr = fio_ctrlr_tmp;
}
ctrlr_g = NULL;
}
pthread_mutex_unlock(&mutex);
if (!ctrlr_g) {
if (pthread_cancel(g_ctrlr_thread_id) == 0) {
pthread_join(g_ctrlr_thread_id, NULL);
}
}
}
/* This function enables addition of SPDK parameters to the fio config