diff options
author | Kevin Wolf <kwolf@redhat.com> | 2012-04-11 11:06:37 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-04-19 15:48:52 +0200 |
commit | 7094f12f868fc1b75b105bcc676e15964dab77af (patch) | |
tree | b5e8acc8d3280beedb9c30d6edf9f9bfac39a29e /block.c | |
parent | aafcdcc9ebd72b24bf8686f624ff98bb919de5fd (diff) | |
download | qemu-7094f12f868fc1b75b105bcc676e15964dab77af.zip qemu-7094f12f868fc1b75b105bcc676e15964dab77af.tar.gz qemu-7094f12f868fc1b75b105bcc676e15964dab77af.tar.bz2 |
block: Drain requests in bdrv_close
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 <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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; } |