account for delayed jobs when reaping threads
authorAaron Carroll <aaronc@gelato.unsw.edu.au>
Wed, 20 Feb 2008 08:14:12 +0000 (09:14 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 20 Feb 2008 08:14:12 +0000 (09:14 +0100)
reap_threads does not account for jobs that have been delayed
(e.g. via startdelay) which may lead to all threads being
terminated.  The following job file demonstrates the problem:

[job1]
filename=job1file
size=16k
startdelay=1

Signed-off-by: Aaron Carroll <aaronc@gelato.unsw.edu.au>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fio.c

diff --git a/fio.c b/fio.c
index 355d8730862643eb02aff27a90d56f1188818572..6e25c5fe6feb6df17a530b283612e695224437c6 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -1024,7 +1024,11 @@ static void reap_threads(int *nr_running, int *t_rate, int *m_rate)
                else
                        realthreads++;
 
                else
                        realthreads++;
 
-               if (!td->pid || td->runstate == TD_REAPED)
+               if (!td->pid) {
+                       pending++;
+                       continue;
+               }
+               if (td->runstate == TD_REAPED)
                        continue;
                if (td->o.use_thread) {
                        if (td->runstate == TD_EXITED) {
                        continue;
                if (td->o.use_thread) {
                        if (td->runstate == TD_EXITED) {