From: Bruce Cran Date: Fri, 1 Nov 2013 18:32:40 +0000 (-0600) Subject: server: ensure that fio_time_init() is called before option parsing X-Git-Tag: fio-2.1.4~9 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=334185e9e18c36b13c713ccdbb65e7ebd84795db;hp=70a61165b46f210407bcac839b4f0ffe7b4e009f 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 --- 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();