From 334185e9e18c36b13c713ccdbb65e7ebd84795db Mon Sep 17 00:00:00 2001 From: Bruce Cran Date: Fri, 1 Nov 2013 12:32:40 -0600 Subject: [PATCH 1/1] server: ensure that fio_time_init() is called before option parsing When run in server mode, jobs are processed before fio_time_init() is called, which causes pthread_setspecific() to be called before pthread_key_create(). Work around this by calling it in thread_main() too. Signed-off-by: Jens Axboe --- backend.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend.c b/backend.c index 180a4874..00a23db6 100644 --- a/backend.c +++ b/backend.c @@ -1129,6 +1129,11 @@ static void *thread_main(void *data) } else td->pid = gettid(); + /* + * fio_time_init() may not have been called yet if running as a server + */ + fio_time_init(); + fio_local_clock_init(o->use_thread); dprint(FD_PROCESS, "jobs pid=%d started\n", (int) td->pid); @@ -1590,7 +1595,7 @@ static void run_threads(void) if (fio_gtod_offload && fio_start_gtod_thread()) return; - + fio_idle_prof_init(); set_sig_handlers(); -- 2.25.1