engines/libaio: modify getevents and commit error handling
authorJens Axboe <axboe@fb.com>
Fri, 3 Oct 2014 19:10:23 +0000 (13:10 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 3 Oct 2014 19:10:23 +0000 (13:10 -0600)
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 <axboe@fb.com>
engines/libaio.c

index 31c850e44d8ea65b4592c99a37273cb9466afd22..6c5d73ed27dd1751ac98c1177fcdbf2bdf2fe487 100644 (file)
@@ -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);