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 <jongh2.jeong@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
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);