engines/libaio: fix issue with EAGAIN
authorJens Axboe <axboe@fb.com>
Tue, 30 Sep 2014 19:33:23 +0000 (13:33 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 30 Sep 2014 19:33:23 +0000 (13:33 -0600)
commitacd45e028cfaf15a29eedcba3ff95c804e2d29e9
tree9257c9386376f1f8fcf58fa554382e4844bce02e
parenteffd6ff0d9f701a64d6bc46509eedfdcfd12f553
engines/libaio: fix issue with EAGAIN

If we get -EAGAIN on IO submission, we should back off and reap
some events. Currently we just loop trying to resubmit, and this
has been reported to cause hangs in some virtualized environments.
There's no record of this ever being hit on raw metal.

So implement this backoff. Unfortunately it requires rewriting
the io_u tracking in libaio, since otherwise we depend on being
able to submit all the io_u's we are handed. So change the
tracking to be a ring buffer, with submission bumping the head
and completion bumping the tail. With this in place, we can't
stop issuing IO at anytime, since we'll just continue where
we left off.

Signed-off-by: Jens Axboe <axboe@fb.com>
engines/libaio.c