]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/qemu-xen-traditional.git/commitdiff
xen: Disable use of O_DIRECT by default as it results in crashes.
authorAlex Bligh <alex@alex.org.uk>
Fri, 15 Mar 2013 18:25:15 +0000 (18:25 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 15 Mar 2013 18:26:46 +0000 (18:26 +0000)
Due to what is almost certainly a kernel bug, writes with O_DIRECT may
continue to reference the page after the write has been marked as
completed, particularly in the case of TCP retransmit. In other
scenarios, this "merely" risks data corruption on the write, but with
Xen pages from domU are only transiently mapped into dom0's memory,
resulting in kernel panics when they are subsequently accessed.

This brings PV devices in line with emulated devices.  Removing
O_DIRECT is safe as barrier operations are now correctly passed
through.

See:
  http://lists.xen.org/archives/html/xen-devel/2012-12/msg01154.html
for more details.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Backported to qemu-xen-unstable,
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
hw/xen_disk.c

index 33a5531aa9e2ca2b4b0bbf91ad6fc73f5a09c646..ee8d36f9dbf3c754232d528485cbeff1fd66504e 100644 (file)
@@ -635,7 +635,7 @@ static int blk_init(struct XenDevice *xendev)
        return -1;
 
     /* read-only ? */
-    qflags = BDRV_O_NOCACHE;
+    qflags = BDRV_O_CACHE_WB;
     if (strcmp(blkdev->mode, "w") == 0) {
        mode   = O_RDWR;
        qflags |= BDRV_O_RDWR;