From: Jens Axboe Date: Mon, 7 Nov 2005 15:57:33 +0000 (+0100) Subject: [PATCH] fio: fix aio syscall returns and io_u leak on end-of-io X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=406e7b7c112ab7ca6c3a7f32fab07ed6faaa15a5;p=disktools.git [PATCH] fio: fix aio syscall returns and io_u leak on end-of-io --- diff --git a/fio.c b/fio.c index 27e0e36..f546151 100644 --- a/fio.c +++ b/fio.c @@ -770,8 +770,10 @@ static struct io_u *get_io_u(struct thread_data *td) if (!io_u) return NULL; - if (get_next_offset(td, &io_u->offset)) + if (get_next_offset(td, &io_u->offset)) { + put_io_u(td, io_u); return NULL; + } io_u->buflen = get_next_buflen(td); if (!io_u->buflen) { @@ -1030,9 +1032,9 @@ static int io_u_queue(struct thread_data *td, struct io_u *io_u) ret = io_submit(td->aio_ctx, 1, &iocb); if (ret == 1) return 0; - else if (ret == EAGAIN) + else if (ret == -EAGAIN) usleep(100); - else if (ret == EINTR) + else if (ret == -EINTR) continue; else break; @@ -1228,7 +1230,7 @@ static void do_async_io(struct thread_data *td) ret = io_u_getevents(td, min_evts, td->cur_depth, timeout); if (ret < 0) { - td->error = errno; + td->error = ret; break; } else if (!ret) continue;