server: fix wrong use of exit() in server when daemonized
authorJens Axboe <axboe@fb.com>
Thu, 11 Sep 2014 23:05:58 +0000 (17:05 -0600)
committerJens Axboe <axboe@fb.com>
Thu, 11 Sep 2014 23:05:58 +0000 (17:05 -0600)
We can't use exit(), or we'll trigger the atexit() hook and
free the shared mem used for mutexes, etc. This can cause a
hang when using a daemonized fio server.

Reported-by: Castor Fu <castor@egocast.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
server.c

index e2a6f73..36713ee 100644 (file)
--- a/server.c
+++ b/server.c
@@ -1709,7 +1709,7 @@ int fio_start_server(char *pidfile)
                int ret = write_pid(pid, pidfile);
 
                free(pidfile);
-               exit(ret);
+               _exit(ret);
        }
 
        setsid();