block: Fix multiwrite memory leak in error case

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>
This commit is contained in:
Kevin Wolf 2010-04-06 18:24:07 +02:00 committed by Aurelien Jarno
parent 0f0b604b00
commit 7eb58a6c55

View File

@ -1884,7 +1884,8 @@ int bdrv_aio_multiwrite(BlockDriverState *bs, BlockRequest *reqs, int num_reqs)
reqs[i].error = -EIO; reqs[i].error = -EIO;
goto fail; goto fail;
} else { } else {
mcb->error = -EIO; mcb->num_requests++;
multiwrite_cb(mcb, -EIO);
break; break;
} }
} else { } else {