WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH]: Make Xen 3.1 IDE flush on O_DIRECT with drive cachi

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH]: Make Xen 3.1 IDE flush on O_DIRECT with drive caching off
From: Chris Lalancette <clalance@xxxxxxxxxx>
Date: Tue, 26 Feb 2008 09:41:30 -0500
Delivery-date: Tue, 26 Feb 2008 06:41:56 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.9 (X11/20071115)
All,
     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.

This patch applies to xen-3.1-testing.hg; I still have to test 3.2 (and the new
AIO code) to see if it is affected by this bug.

Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
--- xen-3.1.0-src/tools/ioemu/hw/ide.c.orig     2008-02-25 06:46:26.000000000 
-0500
+++ xen-3.1.0-src/tools/ioemu/hw/ide.c  2008-02-25 06:46:30.000000000 -0500
@@ -1024,7 +1024,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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>