From 813445e7129240d51216e396a5ba8e19296b6581 Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Wed, 4 Jun 2025 22:00:01 +0000 Subject: [PATCH] backend: clean up requeued io_u's When an atttempt to queue an io_u returns FIO_Q_BUSY, the io_u is added to td->io_u_requeues. If the runtime timeout expires with td->io_u_requeues not empty, the job will not close the relevant file because its file->references will be non-zero since the requeued io_u still holds a reference to the file. This patch discards the contents of td->io_u_requeues during io_u cleanup which leads to file closure when its last reference is destroyed. This is relevant for resource-constrained environments. Suggested-by: Jonghwi Jeong Signed-off-by: Vincent Fu --- backend.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend.c b/backend.c index f2a4ad35..0cdee864 100644 --- a/backend.c +++ b/backend.c @@ -1284,6 +1284,10 @@ static void cleanup_io_u(struct thread_data *td) fio_memfree(io_u, sizeof(*io_u), td_offload_overlap(td)); } + while ((io_u = io_u_rpop(&td->io_u_requeues)) != NULL) { + put_io_u(td, io_u); + } + free_io_mem(td); io_u_rexit(&td->io_u_requeues); -- 2.25.1