]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: Restart io_submit if it returns EAGAIN
authorAsias He <asias.hejun@gmail.com>
Mon, 4 Jun 2012 15:10:05 +0000 (23:10 +0800)
committerPekka Enberg <penberg@kernel.org>
Tue, 5 Jun 2012 08:02:03 +0000 (11:02 +0300)
Keep trying if io_submit returns EAGAIN. No need to fail the request.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/util/read-write.c

index 55473ba30dc91db4b14db7b39188fe7cac6d3579..44709dfd4353573b3868f05237532b5847444c96 100644 (file)
@@ -322,23 +322,33 @@ int aio_pwritev(io_context_t ctx, struct iocb *iocb, int fd, const struct iovec
                off_t offset, int ev, void *param)
 {
        struct iocb *ios[1] = { iocb };
+       int ret;
 
        io_prep_pwritev(iocb, fd, iov, iovcnt, offset);
        io_set_eventfd(iocb, ev);
        iocb->data = param;
 
-       return io_submit(ctx, 1, ios);
+restart:
+       ret = io_submit(ctx, 1, ios);
+       if (ret == -EAGAIN)
+               goto restart;
+       return ret;
 }
 
 int aio_preadv(io_context_t ctx, struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt,
                off_t offset, int ev, void *param)
 {
        struct iocb *ios[1] = { iocb };
+       int ret;
 
        io_prep_preadv(iocb, fd, iov, iovcnt, offset);
        io_set_eventfd(iocb, ev);
        iocb->data = param;
 
-       return io_submit(ctx, 1, ios);
+restart:
+       ret = io_submit(ctx, 1, ios);
+       if (ret == -EAGAIN)
+               goto restart;
+       return ret;
 }
-#endif
\ No newline at end of file
+#endif