Fix crash with group_reporting and one group member that never started
authorJens Axboe <axboe@fb.com>
Tue, 29 Mar 2016 14:28:56 +0000 (08:28 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 29 Mar 2016 14:28:56 +0000 (08:28 -0600)
If we have a job that nevers gets started, then we crash in
setting up the group stats, if group_reporting is enabled. This
can be reproduced like this:

fio --name=iwontstart --name=null --ioengine=null --size=1g --group_reporting=1
Starting 2 processes
iwontstart: you need to specify size=
fio: pid=0, err=22/file:filesetup.c:828, func=total_file_size, error=Invalid argument
Segmentation fault (core dumped)

Check for -1 groupid, and just skip the job if so.

Signed-off-by: Jens Axboe <axboe@fb.com>
stat.c

diff --git a/stat.c b/stat.c
index d2720a4b1a177de4d8f70480ff50cfec41db01c3..6d8d4d06748291601056269f8d14832f42e76de5 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1580,6 +1580,8 @@ void __show_run_stats(void)
                unsigned long long bw;
 
                ts = &threadstats[i];
+               if (ts->groupid == -1)
+                       continue;
                rs = &runstats[ts->groupid];
                rs->kb_base = ts->kb_base;
                rs->unit_base = ts->unit_base;