From d89ee9f4c7ac7e0af994e4a4ec02ef07b1698bb9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 1 Aug 2020 11:01:06 -0700 Subject: [PATCH] Prevent that fio hangs when using io_submit_mode=offload This patch has been tested by running the following shell command: for ((i=0;i<1000;i++)); do echo $i; python3 t/run-fio-tests.py -o 10; done Fixes: d28174f0189c ("workqueue: ensure we see deferred error for IOs") Signed-off-by: Bart Van Assche --- rate-submit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rate-submit.c b/rate-submit.c index b7b70372..13dbe7a2 100644 --- a/rate-submit.c +++ b/rate-submit.c @@ -97,8 +97,11 @@ static int io_workqueue_fn(struct submit_worker *sw, td->cur_depth -= ret; } - if (error || td->error) + if (error || td->error) { + pthread_mutex_lock(&td->io_u_lock); pthread_cond_signal(&td->parent->free_cond); + pthread_mutex_unlock(&td->io_u_lock); + } return 0; } -- 2.25.1