]> xenbits.xensource.com Git - qemu-xen-4.3-testing.git/commitdiff
Fix vectored aio bounce handling immediate errors (Avi Kivity)
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
Sat, 28 Mar 2009 16:11:20 +0000 (16:11 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 7 Oct 2009 14:48:50 +0000 (15:48 +0100)
If a bounced vectored aio fails immediately (the inner aio submission
returning NULL) then the bounce handler erronously returns an aio
request which will never be completed (and which crashes when cancelled).

Fix by detecting that the inner request has failed and propagating the
error.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6892 c046a42c-6fe2-441c-8c8c-71466251a162
(cherry picked from commit c240b9af599d20e06a58090366be682684bd8555)

block.c

diff --git a/block.c b/block.c
index 701a56b25c54ebc7577da6133dbc7f1fc96e096d..c3c44a9580e00adc0cec89002c37523e94f462e7 100644 (file)
--- a/block.c
+++ b/block.c
@@ -1414,6 +1414,11 @@ static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs,
         s->aiocb = bdrv_aio_read(bs, sector_num, s->bounce, nb_sectors,
                                  bdrv_aio_rw_vector_cb, s);
     }
+    if (!s->aiocb) {
+        qemu_vfree(s->bounce);
+        qemu_aio_release(s);
+        return NULL;
+    }
     return &s->common;
 }