* [PATCH]: Make Xen 3.1 IDE flush on O_DIRECT with drive caching off
@ 2008-02-26 14:41 Chris Lalancette
2008-02-26 14:51 ` Daniel P. Berrange
2008-02-28 3:23 ` Chris Lalancette
0 siblings, 2 replies; 3+ messages in thread
From: Chris Lalancette @ 2008-02-26 14:41 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 716 bytes --]
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@redhat.com>
[-- Attachment #2: xen-3.1.0-ioemu-odirect-flush.patch --]
[-- Type: text/x-patch, Size: 495 bytes --]
--- 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;
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH]: Make Xen 3.1 IDE flush on O_DIRECT with drive caching off
2008-02-26 14:41 [PATCH]: Make Xen 3.1 IDE flush on O_DIRECT with drive caching off Chris Lalancette
@ 2008-02-26 14:51 ` Daniel P. Berrange
2008-02-28 3:23 ` Chris Lalancette
1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2008-02-26 14:51 UTC (permalink / raw)
To: Chris Lalancette; +Cc: xen-devel
On Tue, Feb 26, 2008 at 09:41:30AM -0500, Chris Lalancette wrote:
> 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@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
I've gone through the logic in ide_write_dma_cb() and breaking out of the
loop is the thing todo in this scenario. The new AIO code in 3.2 looks like
it suffers from a similar problem, with one of the code paths missing the
sync due to a mis-placed label / goto pair.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH]: Make Xen 3.1 IDE flush on O_DIRECT with drive caching off
2008-02-26 14:41 [PATCH]: Make Xen 3.1 IDE flush on O_DIRECT with drive caching off Chris Lalancette
2008-02-26 14:51 ` Daniel P. Berrange
@ 2008-02-28 3:23 ` Chris Lalancette
1 sibling, 0 replies; 3+ messages in thread
From: Chris Lalancette @ 2008-02-28 3:23 UTC (permalink / raw)
To: xen-devel
Chris Lalancette wrote:
> 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.
After some testing, it looks like 3.2 is not affected by this bug, so it
won't be needed there.
Chris Lalancette
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-02-28 3:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-26 14:41 [PATCH]: Make Xen 3.1 IDE flush on O_DIRECT with drive caching off Chris Lalancette
2008-02-26 14:51 ` Daniel P. Berrange
2008-02-28 3:23 ` Chris Lalancette
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.