From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNbxg-0004iQ-LL for qemu-devel@nongnu.org; Tue, 17 Feb 2015 01:48:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNbxd-0004SD-D9 for qemu-devel@nongnu.org; Tue, 17 Feb 2015 01:48:48 -0500 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:33548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNbxd-0004S8-6y for qemu-devel@nongnu.org; Tue, 17 Feb 2015 01:48:45 -0500 Received: by mail-wi0-f178.google.com with SMTP id em10so30734769wid.5 for ; Mon, 16 Feb 2015 22:48:44 -0800 (PST) Sender: Paolo Bonzini Message-ID: <54E2E448.7050702@redhat.com> Date: Tue, 17 Feb 2015 07:48:40 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1424143757-557-1-git-send-email-famz@redhat.com> In-Reply-To: <1424143757-557-1-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] virtio-blk: Check return value of blk_aio_ioctl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi On 17/02/2015 04:29, Fam Zheng wrote: > Since commit 1dc936aa84 (virtio-blk: Use blk_aio_ioctl) we silently lose > the request if blk_aio_ioctl returns NULL (not implemented). > > Fix it by directly returning VIRTIO_BLK_S_UNSUPP as we used to do. > > Signed-off-by: Fam Zheng > --- > hw/block/virtio-blk.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c > index 1a8a176..c7c8f20 100644 > --- a/hw/block/virtio-blk.c > +++ b/hw/block/virtio-blk.c > @@ -197,6 +197,7 @@ static int virtio_blk_handle_scsi_req(VirtIOBlockReq *req) > VirtIODevice *vdev = VIRTIO_DEVICE(req->dev); > VirtQueueElement *elem = &req->elem; > VirtIOBlock *blk = req->dev; > + BlockAIOCB *acb; > > #ifdef __linux__ > int i; > @@ -278,8 +279,12 @@ static int virtio_blk_handle_scsi_req(VirtIOBlockReq *req) > ioctl_req->hdr.sbp = elem->in_sg[elem->in_num - 3].iov_base; > ioctl_req->hdr.mx_sb_len = elem->in_sg[elem->in_num - 3].iov_len; > > - blk_aio_ioctl(blk->blk, SG_IO, &ioctl_req->hdr, > - virtio_blk_ioctl_complete, ioctl_req); > + acb = blk_aio_ioctl(blk->blk, SG_IO, &ioctl_req->hdr, > + virtio_blk_ioctl_complete, ioctl_req); > + if (!acb) { > + status = VIRTIO_BLK_S_UNSUPP; > + goto fail; > + } > return -EINPROGRESS; > #else > abort(); > Reviewed-by: Paolo Bonzini