Commit e7d54ae83c4ffb63a2481d17f136110ab421afc5

Authored by Christoph Hellwig
Committed by Anthony Liguori
1 parent e8a6aec9

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 <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 10 additions and 1 deletions
posix-aio-compat.c
... ... @@ -90,7 +90,16 @@ static size_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb)
90 90 ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);
91 91 if (ret == -1)
92 92 return -errno;
93   - return ret;
  93 +
  94 + /*
  95 + * This looks weird, but the aio code only consideres a request
  96 + * successfull if it has written the number full number of bytes.
  97 + *
  98 + * Now we overload aio_nbytes as aio_ioctl_cmd for the ioctl command,
  99 + * so in fact we return the ioctl command here to make posix_aio_read()
  100 + * happy..
  101 + */
  102 + return aiocb->aio_nbytes;
94 103 }
95 104  
96 105 #ifdef HAVE_PREADV
... ...