Skip to content

Commit

Permalink
migration: hold AioContext lock for loadvm qemu_fclose()
Browse files Browse the repository at this point in the history
migration_incoming_state_destroy() uses qemu_fclose() on the vmstate
file.  Make sure to call it inside an AioContext acquire/release region.

This fixes an 'qemu: qemu_mutex_unlock: Operation not permitted' abort
in loadvm.

This patch closes the vmstate file before ending the drained region.
Previously we closed the vmstate file after ending the drained region.
The order does not matter.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
stefanhaRH authored and kevmw committed Jun 26, 2017
1 parent 0d2fac8 commit 1575829
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion migration/savevm.c
Expand Up @@ -2300,11 +2300,11 @@ int load_snapshot(const char *name, Error **errp)

aio_context_acquire(aio_context);
ret = qemu_loadvm_state(f);
migration_incoming_state_destroy();
aio_context_release(aio_context);

bdrv_drain_all_end();

migration_incoming_state_destroy();
if (ret < 0) {
error_setg(errp, "Error %d while loading VM state", ret);
return ret;
Expand Down

0 comments on commit 1575829

Please sign in to comment.