Skip to content

Commit

Permalink
block: Fix AioContext switch for drained node
Browse files Browse the repository at this point in the history
When a drained node changes its AioContext, we need to move its
aio_disable_external() to the new context, too.

Without this fix, drain_end will try to reenable the new context, which
has never been disabled, so an assertion failure is triggered.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
  • Loading branch information
kevmw committed Feb 25, 2019
1 parent 6c75d76 commit e64f25f
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 @@ -5227,6 +5227,9 @@ void bdrv_detach_aio_context(BlockDriverState *bs)
bdrv_detach_aio_context(child->bs);
}

if (bs->quiesce_counter) {
aio_enable_external(bs->aio_context);
}
bs->aio_context = NULL;
}

Expand All @@ -5240,6 +5243,10 @@ void bdrv_attach_aio_context(BlockDriverState *bs,
return;
}

if (bs->quiesce_counter) {
aio_disable_external(new_context);
}

bs->aio_context = new_context;

QLIST_FOREACH(child, &bs->children, next) {
Expand Down

0 comments on commit e64f25f

Please sign in to comment.