More iolog fixes
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 6f4fddae8f0cbcbdc28cc96dcbd7e722b3b07997..d8c143332823bf2c488ef0799951c8ce70c71fe3 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -70,7 +70,10 @@ static void terminate_threads(int group_id)
 
        for_each_td(td, i) {
                if (group_id == TERMINATE_ALL || groupid == td->groupid) {
-                       if (td->runstate <= TD_RUNNING)
+                       /*
+                        * if the thread is running, just let it exit
+                        */
+                       if (td->runstate < TD_RUNNING)
                                kill(td->pid, SIGQUIT);
                        td->terminate = 1;
                        td->o.start_delay = 0;
@@ -308,6 +311,7 @@ static void do_verify(struct thread_data *td)
 
                if (runtime_exceeded(td, &io_u->start_time)) {
                        put_io_u(td, io_u);
+                       td->terminate = 1;
                        break;
                }
 
@@ -438,6 +442,7 @@ static void do_io(struct thread_data *td)
 
                if (runtime_exceeded(td, &s)) {
                        put_io_u(td, io_u);
+                       td->terminate = 1;
                        break;
                }
 
@@ -751,7 +756,6 @@ static void *thread_main(void *data)
        unsigned long long runtime[2];
        struct thread_data *td = data;
        unsigned long elapsed;
-       struct timeval t;
        int clear_state;
 
        if (!td->o.use_thread)
@@ -861,10 +865,6 @@ static void *thread_main(void *data)
                if (td->error || td->terminate)
                        break;
 
-               fio_gettime(&t, NULL);
-               if (runtime_exceeded(td, &t))
-                       break;
-
                if (td->o.verify == VERIFY_NONE)
                        continue;