Remove ->mutex after last use, not on job exit
authorJens Axboe <jens.axboe@oracle.com>
Fri, 9 Mar 2007 11:42:35 +0000 (12:42 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 9 Mar 2007 11:42:35 +0000 (12:42 +0100)
Frees up that file descriptor.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c

diff --git a/fio.c b/fio.c
index 3cf2a9b13220a2e6eece254d98547667f04963e5..6ce46ba5a31e9be12d4c2cc6ef524ec5297837c4 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -734,6 +734,12 @@ static void *thread_main(void *data)
        fio_sem_up(startup_sem);
        fio_sem_down(td->mutex);
 
+       /*
+        * the ->mutex semaphore is now no longer used, close it to avoid
+        * eating a file descriptor
+        */
+       fio_sem_remove(td->mutex);
+
        if (!td->create_serialize && setup_files(td))
                goto err;
 
@@ -930,8 +936,6 @@ reaped:
                                perror("pthread_join");
                }
 
-               fio_sem_remove(td->mutex);
-
                (*nr_running)--;
                (*m_rate) -= td->ratemin;
                (*t_rate) -= td->rate;