]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
block: Fix multiwrite memory leak in error case
authorKevin Wolf <kwolf@redhat.com>
Tue, 6 Apr 2010 16:24:07 +0000 (18:24 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 9 Apr 2010 23:15:54 +0000 (01:15 +0200)
Previously multiwrite_user_cb was never called if a request in the multiwrite
batch failed right away because it did set mcb->error immediately. Make it look
more like a normal callback to fix this.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 7eb58a6c556c3880e6712cbf6d24d681261c5095)

block.c

diff --git a/block.c b/block.c
index d537d10b680bf14125473424babfef95bb95d35e..4f9a48b71a664568a1c0c37a0604345e1910a2e4 100644 (file)
--- a/block.c
+++ b/block.c
@@ -1761,7 +1761,8 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)
                 reqs[i].error = -EIO;
                 goto fail;
             } else {
-                mcb->error = -EIO;
+                mcb->num_requests++;
+                multiwrite_cb(mcb, -EIO);
                 break;
             }
         } else {