From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Lalancette Subject: [PATCH]: Make Xen 3.1 IDE flush on O_DIRECT with drive caching off Date: Tue, 26 Feb 2008 09:41:30 -0500 Message-ID: <47C4251A.3040000@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080406000308030701050502" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------080406000308030701050502 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------080406000308030701050502 Content-Type: text/x-patch; name="xen-3.1.0-ioemu-odirect-flush.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xen-3.1.0-ioemu-odirect-flush.patch" --- 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; --------------080406000308030701050502 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------080406000308030701050502--