X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=fio.c;h=0ccd5d857e0002abac481e72e5934fcde1d34f74;hp=75c2c869947d0de6b852e996eccecaa74c197bc4;hb=0c6e75175bcaf8d05bfa88aa8caa584fbb848b74;hpb=49db69aa2e89afde2c5e2a768a464302af96b6cb diff --git a/fio.c b/fio.c index 75c2c869..0ccd5d85 100644 --- a/fio.c +++ b/fio.c @@ -160,9 +160,19 @@ static void cleanup_pending_aio(struct thread_data *td) list_for_each_safe(entry, n, &td->io_u_busylist) { io_u = list_entry(entry, struct io_u, list); - r = td->io_ops->cancel(td, io_u); - if (!r) + /* + * if the io_u isn't in flight, then that generally + * means someone leaked an io_u. complain but fix + * it up, so we don't stall here. + */ + if ((io_u->flags & IO_U_F_FLIGHT) == 0) { + log_err("fio: non-busy IO on busy list\n"); put_io_u(td, io_u); + } else { + r = td->io_ops->cancel(td, io_u); + if (!r) + put_io_u(td, io_u); + } } } @@ -248,15 +258,20 @@ static void do_verify(struct thread_data *td) if (!io_u) break; - if (runtime_exceeded(td, &io_u->start_time)) + if (runtime_exceeded(td, &io_u->start_time)) { + put_io_u(td, io_u); break; + } - if (get_next_verify(td, io_u)) + if (get_next_verify(td, io_u)) { + put_io_u(td, io_u); break; + } - if (td_io_prep(td, io_u)) + if (td_io_prep(td, io_u)) { + put_io_u(td, io_u); break; - + } requeue: ret = td_io_queue(td, io_u); @@ -548,6 +563,7 @@ static int init_io_u(struct thread_data *td) fill_rand_buf(io_u, max_bs); io_u->index = i; + io_u->flags = IO_U_F_FREE; list_add(&io_u->list, &td->io_u_freelist); }