Skip to contentSkip to conversation

fix asynchronous ioctls

PATCH In review Christoph Hellwig 2 participants 4 messages Apr 28, 2009 – May 4, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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.

[NB: this function is formatted using tabs, so the new code is too.
Or should I convert the whole function in my patch?]

posix-aio-compat.c +10 -1
Index: qemu/posix-aio-compat.c
===================================================================
@@ -90,7 +90,16 @@ static size_t handle_aiocb_ioctl(struct 
 	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
#1 lore raw
Quoted 9 lines · Christoph Hellwig

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.

[NB: this function is formatted using tabs, so the new code is too.
Or should I convert the whole function in my patch?]

Is there a 2/2?

Regards,

Anthony Liguori

#2 lore raw
Quoted 4 lines · Anthony Liguori
Quoted 3 lines · Christoph Hellwig

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.

Quoted 8 lines
Quoted 6 lines

[NB: this function is formatted using tabs, so the new code is too. Or should I convert the whole function in my patch?]

Is there a 2/2?

2/2 is the SG_IO passthrough which I accidentally sent as reply to the previous version.

#3 lore raw
Quoted 2 lines · Christoph Hellwig

2/2 is the SG_IO passthrough which I accidentally sent as reply to the previous version.

Any reason you pulled in the SG_IO passthrough but not this patch?

It's not going to work without it :)

Also the commits list seems to be a lagging a little bit, can't find messages for at least the two patches you applied from me.