From 6be06c46544c19e513ff80e7b841b1de688ffc66 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 1 Dec 2016 21:23:47 -0700 Subject: [PATCH] log: fix for crash with rate IO and logging 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 --- backend.c | 7 ++----- io_u.c | 3 +++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend.c b/backend.c index 8616fc2a..ac71521e 100644 --- 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; - 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 diff --git a/io_u.c b/io_u.c index 428d4b7f..74206297 100644 --- a/io_u.c +++ b/io_u.c @@ -653,6 +653,9 @@ int io_u_quiesce(struct thread_data *td) completed += ret; } + if (td->flags & TD_F_REGROW_LOGS) + regrow_logs(td); + return completed; } -- 2.25.1