diff options
Diffstat (limited to 'migration/savevm.c')
-rw-r--r-- | migration/savevm.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/migration/savevm.c b/migration/savevm.c index 6bfd4893e0..5846d9c369 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2144,6 +2144,14 @@ int save_snapshot(const char *name, Error **errp) goto the_end; } + /* The bdrv_all_create_snapshot() call that follows acquires the AioContext + * for itself. BDRV_POLL_WHILE() does not support nested locking because + * it only releases the lock once. Therefore synchronous I/O will deadlock + * unless we release the AioContext before bdrv_all_create_snapshot(). + */ + aio_context_release(aio_context); + aio_context = NULL; + ret = bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs); if (ret < 0) { error_setg(errp, "Error while creating snapshot on '%s'", @@ -2154,7 +2162,9 @@ int save_snapshot(const char *name, Error **errp) ret = 0; the_end: - aio_context_release(aio_context); + if (aio_context) { + aio_context_release(aio_context); + } if (saved_vm_running) { vm_start(); } |