log: fix for crash with rate IO and logging
authorJens Axboe <axboe@fb.com>
Fri, 2 Dec 2016 04:23:47 +0000 (21:23 -0700)
committerJens Axboe <axboe@fb.com>
Fri, 2 Dec 2016 04:23:47 +0000 (21:23 -0700)
If we run with an IO rate, and it happens to be low enough that
we never need to wait for the queue full condition, we will never
regrow the log and hence crash in stat.c on this line:

assert(iolog->pending->nr_samples < iolog->pending->max_samples);

Fix this by shuffling the code around a bit, so io_u_quiesce()
regrows the log, if needed, after having reaped completions.

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

index 8616fc2a7b2df84b0b00509ad14f96fe4eea29d8..ac71521e94fc4420714823aab73c45a924e0432d 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -441,11 +441,8 @@ static int wait_for_completions(struct thread_data *td, struct timeval *time)
        int min_evts = 0;
        int ret;
 
        int min_evts = 0;
        int ret;
 
-       if (td->flags & TD_F_REGROW_LOGS) {
-               ret = io_u_quiesce(td);
-               regrow_logs(td);
-               return ret;
-       }
+       if (td->flags & TD_F_REGROW_LOGS)
+               return io_u_quiesce(td);
 
        /*
         * if the queue is full, we MUST reap at least 1 event
 
        /*
         * if the queue is full, we MUST reap at least 1 event
diff --git a/io_u.c b/io_u.c
index 428d4b7ff42adc54a397cfa6ed810edb0a2850f4..7420629740f458ca644fcc2de47891f359d78cd5 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -653,6 +653,9 @@ int io_u_quiesce(struct thread_data *td)
                        completed += ret;
        }
 
                        completed += ret;
        }
 
+       if (td->flags & TD_F_REGROW_LOGS)
+               regrow_logs(td);
+
        return completed;
 }
 
        return completed;
 }