summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-03-17 13:03:44 +0100
committerKevin Wolf <kwolf@redhat.com>2017-03-17 13:03:44 +0100
commit11f0f5e553cff93d5fc77d67b98c40adba12b729 (patch)
tree7bd64123338972d3ee650aeb26a81a068d630f24
parentb7a745dc33a18377bb4a8dfe54d1df01ea60bf66 (diff)
parentc2b6428d388b3f03261be7b0be770919e4e3e5ec (diff)
downloadfocaccia-qemu-11f0f5e553cff93d5fc77d67b98c40adba12b729.tar.gz
focaccia-qemu-11f0f5e553cff93d5fc77d67b98c40adba12b729.zip
Merge remote-tracking branch 'mreitz/tags/pull-block-2017-03-17' into queue-block
Block patches for 2.9-rc1

# gpg: Signature made Fri Mar 17 12:59:20 2017 CET
# gpg:                using RSA key 0xF407DB0061D5CF40
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>"
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* mreitz/tags/pull-block-2017-03-17:
  block: quiesce AioContext when detaching from it

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/block.c b/block.c
index e53808425e..6e906ec53c 100644
--- a/block.c
+++ b/block.c
@@ -4350,8 +4350,15 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
 
 void bdrv_set_aio_context(BlockDriverState *bs, AioContext *new_context)
 {
+    AioContext *ctx;
+
     bdrv_drain(bs); /* ensure there are no in-flight requests */
 
+    ctx = bdrv_get_aio_context(bs);
+    while (aio_poll(ctx, false)) {
+        /* wait for all bottom halves to execute */
+    }
+
     bdrv_detach_aio_context(bs);
 
     /* This function executes in the old AioContext so acquire the new one in