From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lyk3s-0007v8-5b for qemu-devel@nongnu.org; Tue, 28 Apr 2009 05:57:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lyk3l-0007uA-RZ for qemu-devel@nongnu.org; Tue, 28 Apr 2009 05:57:11 -0400 Received: from [199.232.76.173] (port=37661 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lyk3l-0007u6-Iq for qemu-devel@nongnu.org; Tue, 28 Apr 2009 05:57:05 -0400 Received: from verein.lst.de ([213.95.11.210]:44754) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1Lyk3k-0000xz-Vj for qemu-devel@nongnu.org; Tue, 28 Apr 2009 05:57:05 -0400 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id n3S9v2IF004847 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Tue, 28 Apr 2009 11:57:02 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-6.6) id n3S9v24T004845 for qemu-devel@nongnu.org; Tue, 28 Apr 2009 11:57:02 +0200 Date: Tue, 28 Apr 2009 11:57:02 +0200 From: Christoph Hellwig Message-ID: <20090428095702.GA4710@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH 1/2] fix asynchronous ioctls List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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?] Signed-off-by: Christoph Hellwig Index: qemu/posix-aio-compat.c =================================================================== --- qemu.orig/posix-aio-compat.c 2009-04-28 11:42:33.801074561 +0200 +++ qemu/posix-aio-compat.c 2009-04-28 11:44:18.392076590 +0200 @@ -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