cpus: flush all requests on each vm stop
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 22 Nov 2010 17:52:22 +0000 (19:52 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 9 Dec 2010 10:47:19 +0000 (12:47 +0200)
Flush all requests once we have stopped all
cpus and devices.
Make sure disk is in consistent state.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jason Wang <jasowang@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
cpus.c

diff --git a/cpus.c b/cpus.c
index 91a0fb1146aa2c9cfbc0a09066cb7b3a39d7e7cb..0309189bfd69564352c8d6260e2f9592e18c8f5c 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -111,6 +111,8 @@ static void do_vm_stop(int reason)
         vm_running = 0;
         pause_all_vcpus();
         vm_state_notify(0, reason);
+        qemu_aio_flush();
+        bdrv_flush_all();
         monitor_protocol_event(QEVENT_STOP, NULL);
     }
 }