From a31dc2dddbdd3e37129799fd4c96be9083bd9845 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 3 Oct 2014 13:10:23 -0600 Subject: [PATCH] engines/libaio: modify getevents and commit error handling If we get some error other than -EAGAIN in getevents(), treat it as fatal and break. If we get -ENOMEM on submission, reap events if we can. If we have no pending events, treat it as a fatal error and break. Signed-off-by: Jens Axboe --- engines/libaio.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engines/libaio.c b/engines/libaio.c index 31c850e4..6c5d73ed 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -167,6 +167,8 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min, events += r; else if (r == -EAGAIN) usleep(100); + else + break; } while (events < min); return r < 0 ? r : events; @@ -283,6 +285,15 @@ static int fio_libaio_commit(struct thread_data *td) } usleep(1); continue; + } else if (ret == -ENOMEM) { + /* + * If we get -ENOMEM, reap events if we can. If + * we cannot, treat it as a fatal event since there's + * nothing we can do about it. + */ + if (ld->queued) + ret = 0; + break; } else break; } while (ld->queued); -- 2.25.1