Keep trying if io_submit returns EAGAIN. No need to fail the request.
Signed-off-by: Asias He <[email protected]>
---
tools/kvm/util/read-write.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/tools/kvm/util/read-write.c b/tools/kvm/util/read-write.c
index 55473ba..44709df 100644
--- a/tools/kvm/util/read-write.c
+++ b/tools/kvm/util/read-write.c
@@ -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
--
1.7.10.2
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html