Skip to content

Commit

Permalink
Merge remote-tracking branch 'mreitz/tags/pull-block-2017-03-17' into…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>"
# 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 <[email protected]>
  • Loading branch information
kevmw committed Mar 17, 2017
2 parents b7a745d + c2b6428 commit 11f0f5e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 11f0f5e

Please sign in to comment.