src/queue: don't wait twice if looping in _io_uring_get_cqe()
src/queue: don't wait twice if looping in _io_uring_get_cqe()

If the caller asks for > 1 events with a timeout and we get just 1 event,
then we end up looping around and issuing an IORING_ENTER_GETEVENTS
with the timeout set twice. This results in twice the timeout that the
caller asked for.

Add a ->has_ts argument to struct get_data and don't re-enter if we've
already looped and it is set.

Also be a bit saner in not overwriting the return value, if set, and
return the initial value from io_uring_enter().

Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@kernel.dk>

axboe/liburing,axboe/liburing,axboe/liburing