Skip to contentSkip to conversation

call bdrv_drain_all() even if the vm is stopped

PATCH Applied Wen Congyang 2 participants 2 messages Nov 20, 2015 – Nov 23, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 call bdrv_drain_all() even if the vm is stopped

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.

---
 cpus.c | 2 ++
 1 file changed, 2 insertions(+)
cpus.c +2 -0
index 877bd70..43676fa 100644
@@ -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();
Signature · 1 line
2.5.0
#1 lore raw
Quoted 15 lines · Wen Congyang

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.

---
 cpus.c | 2 ++
 1 file changed, 2 insertions(+)
cpus.c +0 -0
index 877bd70..43676fa 100644

cpus.c int vm_stop_force_state(RunState state) · line 1422

Quoted 8 lines
cpus.c +2 -0
@@ -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();

Queued for 2.5-rc2, thanks!