From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=35911 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7qUM-0005S3-JS for qemu-devel@nongnu.org; Thu, 07 Apr 2011 10:47:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7qUH-0004oE-1c for qemu-devel@nongnu.org; Thu, 07 Apr 2011 10:47:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7qUG-0004nw-PG for qemu-devel@nongnu.org; Thu, 07 Apr 2011 10:47:09 -0400 From: Kevin Wolf Date: Thu, 7 Apr 2011 16:49:10 +0200 Message-Id: <1302187764-16421-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1302187764-16421-1-git-send-email-kwolf@redhat.com> References: <1302187764-16421-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 01/15] hw/xen_disk: ioreq not finished on error List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Feiran Zheng Bug fix: routines 'ioreq_runio_qemu_sync' and 'ioreq_runio_qemu_aio' won't call 'ioreq_unmap' or 'ioreq_finish' on errors, leaving ioreq in the blkdev->inflight list and a leak. Signed-off-by: Feiran Zheng Acked-by: Stefano Stabellini Signed-off-by: Kevin Wolf --- hw/xen_disk.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 445bf03..558bf8a 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -310,7 +310,7 @@ static int ioreq_runio_qemu_sync(struct ioreq *ioreq) off_t pos; if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1) - goto err; + goto err_no_map; if (ioreq->presync) bdrv_flush(blkdev->bs); @@ -364,6 +364,9 @@ static int ioreq_runio_qemu_sync(struct ioreq *ioreq) return 0; err: + ioreq_unmap(ioreq); +err_no_map: + ioreq_finish(ioreq); ioreq->status = BLKIF_RSP_ERROR; return -1; } @@ -393,7 +396,7 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq) struct XenBlkDev *blkdev = ioreq->blkdev; if (ioreq->req.nr_segments && ioreq_map(ioreq) == -1) - goto err; + goto err_no_map; ioreq->aio_inflight++; if (ioreq->presync) @@ -427,6 +430,9 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq) return 0; err: + ioreq_unmap(ioreq); +err_no_map: + ioreq_finish(ioreq); ioreq->status = BLKIF_RSP_ERROR; return -1; } -- 1.7.2.3