call bdrv_drain_all() even if the vm is stopped
authorWen Congyang <wency@cn.fujitsu.com>
Fri, 20 Nov 2015 09:34:38 +0000 (17:34 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 26 Nov 2015 15:47:44 +0000 (16:47 +0100)
There are still I/O operations when the vm is stopped. For example,
stop the vm, and do block migration. In this case, we don't drain all
I/O operation, and may meet the following problem:

qemu-system-x86_64: migration/block.c:731: block_save_complete: Assertion `block_mig_state.submitted == 0' failed.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Message-Id: <564EE92E.4070701@cn.fujitsu.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
cpus.c

diff --git a/cpus.c b/cpus.c
index 877bd70a278249b271414da5b8c0f30d06832356..43676fa1f31622b002387e7da02cfbcecdc8e85a 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -1415,6 +1415,8 @@ int vm_stop_force_state(RunState state)
         return vm_stop(state);
     } else {
         runstate_set(state);
+
+        bdrv_drain_all();
         /* Make sure to return an error if the flush in a previous vm_stop()
          * failed. */
         return bdrv_flush_all();