]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
aio-posix: don't pass ns timeout to epoll_wait()
authorStefan Hajnoczi <stefanha@redhat.com>
Fri, 14 Feb 2020 17:17:09 +0000 (17:17 +0000)
committerStefan Hajnoczi <stefanha@redhat.com>
Sat, 22 Feb 2020 08:26:47 +0000 (08:26 +0000)
Don't pass the nanosecond timeout into epoll_wait(), which expects
milliseconds.

The epoll_wait() timeout value does not matter if qemu_poll_ns()
determined that the poll fd is ready, but passing a value in the wrong
units is still ugly.  Pass a 0 timeout to epoll_wait() instead.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Sergio Lopez <slp@redhat.com>
Message-id: 20200214171712.541358-3-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
util/aio-posix.c

index c964627a03b0353b3eed8d1fb04f8438d13d892f..58765e581e471acf5ec073b33f296ec546d40d22 100644 (file)
@@ -117,6 +117,9 @@ static int aio_epoll(AioContext *ctx, int64_t timeout)
 
     if (timeout > 0) {
         ret = qemu_poll_ns(&pfd, 1, timeout);
+        if (ret > 0) {
+            timeout = 0;
+        }
     }
     if (timeout <= 0 || ret > 0) {
         ret = epoll_wait(ctx->epollfd, events,