]> Git Repo - qemu.git/commitdiff
block: Drain requests in bdrv_close
authorKevin Wolf <[email protected]>
Wed, 11 Apr 2012 09:06:37 +0000 (11:06 +0200)
committerKevin Wolf <[email protected]>
Thu, 19 Apr 2012 13:48:52 +0000 (15:48 +0200)
If an AIO request is in flight that refers to a BlockDriverState that
has been closed and possibly even freed, more or less anything could
happen. I have seen segfaults, -EBADF return values and qcow2 sometimes
actually catches the situation in bdrv_close() and abort()s.

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Paolo Bonzini <[email protected]>
block.c

diff --git a/block.c b/block.c
index c0c90f061b82445212fcc1c90130d34079fda387..4b96654e7d6264a32b393a929c47be3edba2c156 100644 (file)
--- a/block.c
+++ b/block.c
@@ -816,6 +816,8 @@ void bdrv_close(BlockDriverState *bs)
         if (bs->job) {
             block_job_cancel_sync(bs->job);
         }
+        bdrv_drain_all();
+
         if (bs == bs_snapshots) {
             bs_snapshots = NULL;
         }
This page took 0.030349 seconds and 4 git commands to generate.