diff mbox

hw/xen_disk: aio_inflight not released in handling ioreq when nr_segments==0

Message ID AANLkTi=AQm8-387iru=Fg++R+Fr0bGzJP0S3Oa28pWNt@mail.gmail.com
State New
Headers show

Commit Message

Feiran Zheng March 9, 2011, 1:19 p.m. UTC
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>
---
 hw/xen_disk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Stefano Stabellini March 9, 2011, 2:42 p.m. UTC | #1
On Wed, 9 Mar 2011, Feiran Zheng wrote:
> 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>
Stefan Hajnoczi March 9, 2011, 3:01 p.m. UTC | #2
On Wed, Mar 9, 2011 at 2:42 PM, Stefano Stabellini
<stefano.stabellini@eu.citrix.com> wrote:
> On Wed, 9 Mar 2011, Feiran Zheng wrote:
>> 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>

Included Kevin so this can be taken up into the block subsystem branch.

Stefan
Kevin Wolf March 9, 2011, 3:54 p.m. UTC | #3
Am 09.03.2011 14:19, schrieb Feiran Zheng:
> 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>

Thanks, applied to the block branch.

Kevin
diff mbox

Patch

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index ed9e5eb..445bf03 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -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);