fix AsyncIO::doWait
authorPhilip Pronin <philipp@fb.com>
Sun, 29 Jun 2014 11:49:47 +0000 (04:49 -0700)
committerTudor Bosman <tudorb@fb.com>
Tue, 1 Jul 2014 23:42:43 +0000 (16:42 -0700)
commitc6bdae86629f05777dfa6d8f2f4f7846da936cda
tree1a5d885357a30722bd6cd0e9f40e49ac8a4f113c
parent09a81a96ea2f9790242675f3c84013266c38d684
fix AsyncIO::doWait

Summary:
As it turns out, `io_getevents` may actually return less than
`min_nr` events.  According to the aio logic
(https://github.com/torvalds/linux/blob/10b5b5361a3c2a7fff9dbfa0f127adc2531e7732/fs/aio.c#L1634),
there may be a couple of rounds required to get at least `nr_min` events, and
if interrupted after the first one, incomplete results would be returned

Test Plan:
fbconfig -r folly/experimental/io/test && fbmake runtests_opt -32

and was no longer able to repro #4609062

Reviewed By: soren@fb.com

FB internal diff: D1410389

Tasks: 4609062
folly/experimental/io/AsyncIO.cpp
folly/experimental/io/AsyncIO.h