And how about this one? index 7c3a42a..12f3b36 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -165,9 +165,9 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min, r = io_getevents(ld->aio_ctx, actual_min, max, ld->aio_events + events, lt); } - if (r >= 0) + if (r > 0) events += r; - else if (r == -EAGAIN) { + else if ((min && r == 0) || r == -EAGAIN) { fio_libaio_commit(td); usleep(100); } else if (r != -EINTR) Regards, Andrey On Wed, Oct 8, 2014 at 6:11 PM, Jens Axboe <axboe@xxxxxxxxx> wrote: > On 10/08/2014 07:52 AM, Andrey Kuzmin wrote: >> Recent libaio fix could be further strengthened with the following >> addition that addresses a latent tight loop bug on zero events being >> returned: >> >> index 7c3a42a..7760fb8 100644 >> --- a/engines/libaio.c >> +++ b/engines/libaio.c >> @@ -165,9 +165,9 @@ static int fio_libaio_getevents(struct thread_data >> *td, unsigned int min, >> r = io_getevents(ld->aio_ctx, actual_min, >> max, ld->aio_events + events, lt); >> } >> - if (r >= 0) >> + if (r > 0) >> events += r; >> - else if (r == -EAGAIN) { >> + else if (r == 0 || r == -EAGAIN) { >> fio_libaio_commit(td); >> usleep(100); >> } else if (r != -EINTR) > > This will break min == 0 being passed in, for the opportunistic check. > We don't want to commit/sleep for that case. > > -- > Jens Axboe > -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html