From e7d54ae83c4ffb63a2481d17f136110ab421afc5 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 28 Apr 2009 11:57:02 +0200 Subject: [PATCH] fix asynchronous ioctls posix_aio_read expect aio requests to return the number of bytes requests to be successfull, so we need to fake this up for ioctls. Signed-off-by: Christoph Hellwig Signed-off-by: Anthony Liguori --- posix-aio-compat.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/posix-aio-compat.c b/posix-aio-compat.c index c7fdac70b4..e9fc9fa60a 100644 --- a/posix-aio-compat.c +++ b/posix-aio-compat.c @@ -90,7 +90,16 @@ static size_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb) ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf); if (ret == -1) return -errno; - return ret; + + /* + * This looks weird, but the aio code only consideres a request + * successfull if it has written the number full number of bytes. + * + * Now we overload aio_nbytes as aio_ioctl_cmd for the ioctl command, + * so in fact we return the ioctl command here to make posix_aio_read() + * happy.. + */ + return aiocb->aio_nbytes; } #ifdef HAVE_PREADV