Skip to contentSkip to conversation

block: Multiwrite error path fixes

PATCH In review Kevin Wolf 2 participants 4 messages Apr 6, 2010 – Apr 9, 2010

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

cover block: Multiwrite error path fixes

Kevin Wolf (2):
block: Fix error code in multiwrite for immediate failures
block: Fix multiwrite memory leak in error case

 block.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
author
#1 lore raw

PATCH 1/2 block: Fix error code in multiwrite for immediate failures

---
 block.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
block.c +2 -2
index 9233af1..ae5aba3 100644
@@ -1890,10 +1890,10 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)
             // submitted yet. Otherwise we'll wait for the submitted AIOs to
             // complete and report the error in the callback.
             if (mcb->num_requests == 0) {
-                reqs[i].error = EIO;
+                reqs[i].error = -EIO;
                 goto fail;
             } else {
-                mcb->error = EIO;
+                mcb->error = -EIO;
                 break;
             }
         } else {
Signature · 1 line
1.6.6.1
author
#2 lore raw

PATCH 2/2 block: Fix multiwrite memory leak in error case

In reply to Kevin Wolf

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.

---
 block.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
block.c +2 -1
index ae5aba3..ed4c819 100644
@@ -1893,7 +1893,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 {
Signature · 1 line
1.6.6.1
#3 lore raw
In reply to Kevin Wolf
Quoted 4 lines · Kevin Wolf

Kevin Wolf (2):
block: Fix error code in multiwrite for immediate failures
block: Fix multiwrite memory leak in error case

Thanks, both applied.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net