Add ->done variable to force exit when we know we are done

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index 16e19c8..bc837c4 100644
--- a/fio.c
+++ b/fio.c
@@ -724,6 +724,8 @@
 {
 	unsigned long long io_done;
 
+	if (td->done)
+		return 0;
 	if (td->o.time_based)
 		return 1;
 	if (td->o.loops) {
diff --git a/fio.h b/fio.h
index b7d8582..ace4b16 100644
--- a/fio.h
+++ b/fio.h
@@ -472,6 +472,7 @@
 		os_random_state_t next_file_state;
 	};
 	int error;
+	int done;
 	pid_t pid;
 	char *orig_buffer;
 	size_t orig_buffer_size;
diff --git a/log.c b/log.c
index cc90f43..7a3327e 100644
--- a/log.c
+++ b/log.c
@@ -91,6 +91,7 @@
 		return 0;
 	}
 
+	td->done = 1;
 	return 1;
 }