From dedb88eb2e4f074fd969133dbdc38ef3be64800b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 29 Mar 2016 08:28:56 -0600 Subject: [PATCH] Fix crash with group_reporting and one group member that never started 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 --- stat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stat.c b/stat.c index d2720a4b..6d8d4d06 100644 --- 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; -- 2.25.1