[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.1-testing] ioemu: IDE flush on O_DIRECT with drive caching off.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204038402 0
# Node ID 215fb8f1f8107131936cf31d69e5b299186a3f83
# Parent  939fccc415c2e1287a165d116d02b9af3eb96750
ioemu: IDE flush on O_DIRECT with drive caching off.

Long ago Xen added code to the device model to basically do an fsync()
after every data write if the user in the guest specified that IDE
write caching should be disabled.  This works fine, except in the case
where you are doing O_DIRECT writes inside the guest (ala dd
if=/dev/zero of=/dev/hdb oflag=direct). This is because you can get
out of ide_write_dma_cb() in the middle of the loop without going
through the logic to sync.  This simple patch makes sure that you
always check (and sync) inside the write callback.

Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 tools/ioemu/hw/ide.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -r 939fccc415c2 -r 215fb8f1f810 tools/ioemu/hw/ide.c
--- a/tools/ioemu/hw/ide.c      Thu Feb 21 15:15:36 2008 +0000
+++ b/tools/ioemu/hw/ide.c      Tue Feb 26 15:06:42 2008 +0000
@@ -1028,7 +1028,9 @@ static int ide_write_dma_cb(IDEState *s,
 #else  /* !DMA_MULTI_THREAD */
                     ;
 #endif /* DMA_MULTI_THREAD */
-                return 0;
+
+               /* make sure that we (possibly) flush before leaving */
+               break;
             }
             if (n > MAX_MULT_SECTORS)
                 n = MAX_MULT_SECTORS;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.