hw/xen_disk: aio_inflight not released in handling ioreq when nr_segments==0
authorFeiran Zheng <famcool@gmail.com>
Wed, 9 Mar 2011 13:19:35 +0000 (21:19 +0800)
committerKevin Wolf <kwolf@redhat.com>
Tue, 15 Mar 2011 12:21:14 +0000 (13:21 +0100)
In hw/xen_disk.c, async writing ioreq is leaked when
ioreq->req.nr_segments==0, because `aio_inflight` flag is not released
properly (skipped by misplaced "break").

Signed-off-by: Feiran Zheng <famcool@gmail.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
hw/xen_disk.c

index ed9e5eb4d7ac56d6021390808ef16c3d932ffca4..445bf03aa0ef037f7509063a99054a636fc6a7e6 100644 (file)
@@ -408,9 +408,9 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
        break;
     case BLKIF_OP_WRITE:
     case BLKIF_OP_WRITE_BARRIER:
-        ioreq->aio_inflight++;
         if (!ioreq->req.nr_segments)
             break;
+        ioreq->aio_inflight++;
         bdrv_aio_writev(blkdev->bs, ioreq->start / BLOCK_SIZE,
                         &ioreq->v, ioreq->v.size / BLOCK_SIZE,
                         qemu_aio_complete, ioreq);