Hello,

Sometimes (specifically when migrating/saving a guest which is doing a big IO 
operation, e.g. copying a big file) there are some (aio-related) BH operations 
pending. These pending BH operations are not saved as state. The ide device 
does not save these operations either, which may lead to data corruption.

The patch makes sure all pending BH/aio operations are flushed.

Comments/better-alternatives are welcome.

Regards,
    Uri.
Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.279
diff -u -r1.279 vl.c
--- vl.c	6 Apr 2007 16:49:48 -0000	1.279
+++ vl.c	16 Apr 2007 14:27:00 -0000
@@ -5048,7 +5048,9 @@
     }
 
     /* ??? Should this occur after vm_stop?  */
-    qemu_aio_flush();
+    do {
+       qemu_aio_flush();
+    } while (qemu_bh_poll());
 
     saved_vm_running = vm_running;
     vm_stop(0);
@@ -5141,7 +5143,9 @@
     }
     
     /* Flush all IO requests so they don't interfere with the new state.  */
-    qemu_aio_flush();
+    do {
+       qemu_aio_flush();
+    } while (qemu_bh_poll());
 
     saved_vm_running = vm_running;
     vm_stop(0);

Reply via email to