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 <famcool@gmail.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
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);
return 0;
err:
+ ioreq_unmap(ioreq);
+err_no_map:
+ ioreq_finish(ioreq);
ioreq->status = BLKIF_RSP_ERROR;
return -1;
}
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)
return 0;
err:
+ ioreq_unmap(ioreq);
+err_no_map:
+ ioreq_finish(ioreq);
ioreq->status = BLKIF_RSP_ERROR;
return -1;
}