Fix bug with stonewall option causing segfault
authorgurudas pai <gurudas.pai@oracle.com>
Wed, 11 Apr 2007 10:44:27 +0000 (12:44 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 11 Apr 2007 10:44:27 +0000 (12:44 +0200)
fio core dumped , with stonewall,

[global]
ioengine=libaio
direct=1
bs=8k
iodepth=1024
iodepth_batch=60
randrepeat=1
size=1024m
directory=/home/oracle
[job1]
rw=randread
filename=file1
[job2]
rw=randwrite
filename=file1

stonewall

[job3]
rw=randread
filename=file1
[job4]
rw=randwrite
filename=file1

 >fio myjob
job1: (g=0): rw=randread, bs=8K-8K/8K-8K, ioengine=libaio, iodepth=1024
job2: (g=1): rw=randwrite, bs=8K-8K/8K-8K, ioengine=libaio, iodepth=1024
job3: (g=1): rw=randread, bs=8K-8K/8K-8K, ioengine=libaio, iodepth=1024
job4: (g=1): rw=randwrite, bs=8K-8K/8K-8K, ioengine=libaio, iodepth=1024
Starting 4 processes
Quit (core dumped)PP] [99.3% done] [  1298/     0 kb/s] [eta 00m:03s]

(gdb) bt
t_rate=0xfeeee790, m_rate=0xfeeee794) at fio.c:1011

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

diff --git a/fio.c b/fio.c
index 89cc5996ca8854c9b9c655a232a366e8d278c9d7..edc6b495789d04e30e88ab520a9204cf37422887 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -990,6 +990,7 @@ static void reap_threads(int *nr_running, int *t_rate, int *m_rate)
                /*
                 * thread is not dead, continue
                 */
+               pending++;
                continue;
 reaped:
                if (td->o.use_thread) {
@@ -1002,6 +1003,7 @@ reaped:
                (*nr_running)--;
                (*m_rate) -= td->o.ratemin;
                (*t_rate) -= td->o.rate;
+               pending--;
 
                if (td->error)
                        exit_value++;