Patchwork [STABLE,08/10] block: Fix multiwrite memory leak in error case

login
register
mail settings
Submitter Kevin Wolf
Date April 9, 2010, 9:46 a.m.
Message ID <1270806388-28138-9-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/49806/
State New
Headers show

Comments

Kevin Wolf - April 9, 2010, 9:46 a.m.
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>
---
 block.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/block.c b/block.c
index d537d10..4f9a48b 100644
--- 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 {