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

Re: [Xen-devel] can't boot from iso on cifs mount

On Tue, 22 Jan 2013, Ian Campbell wrote:
> Please don't top post.
> On Tue, 2013-01-22 at 05:38 +0000, Vasiliy Tolstov wrote:
> > Thanks!
> > I found, that now xl tries to open iso with O_DIRECT flag.
> > open("/var/storage/iso/SW_DVD5_Windows_Svr_DC_EE_SE_Web_2008_R2_64Bit_Russian_w_SP1_MLF_X17-22616_vase.iso",
> > O_RDONLY|O_DIRECT) = -1 EINVAL (Invalid argument)
> > write(2, "qemu: could not open vbd '/local"..., 217) = 217

xl? I guess you mean QEMU tries to open the ISO with O_DIRECT.

> I guess CIFS doesn't support O_DIRECT. It looks like it does have mount
> -o directio though, worth a try.
> I'm not sure what options exist to turn this off from the qemu side --
> Stefano? I also have a feeling something changed in this regard in 4.2.x

Given that you are not passing any device_model_version option to xl, I
assume that you are running qemu-xen-traditional (ps should show that a
binary called qemu-dm is running).

If that is the case, there is currently no way to specify any flags.
However the interesting bit is that qemu-xen-traditional opens files
corresponding to emulated devices with BDRV_O_CACHE_WB and opens files
corresponding to PV interfaces using BDRV_O_NOCACHE (this means
This means that the failure should be caused by hw/xen_disk.c trying to
opening the iso O_DIRECT. Paradoxically the PV inteface for a cdrom
drive is usually never used AFAIK.

Did the Windows PV drivers start using the PV cdrom interface all of a

In any case I think that the best thing we could do it fall back to
write-through (or should it be write-back? It might not be safe..) in
case O_DIRECT fails. This is what qemu-xen does in such cases.

Try this patch:


diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 33a5531..d6d71fe 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -659,9 +659,16 @@ static int blk_init(struct XenDevice *xendev)
        if (blkdev->bs) {
            if (bdrv_open2(blkdev->bs, blkdev->filename, qflags,
                            bdrv_find_format(blkdev->fileproto)) != 0) {
-               bdrv_delete(blkdev->bs);
-               blkdev->bs = NULL;
-           }
+                /* try without O_DIRECT */
+                xen_be_printf(&blkdev->xendev, 0, "opening %s with O_DIRECT 
failed, trying write-through.\n",
+                        blkdev->filename);
+                qflags &= BDRV_O_NOCACHE;
+                if (bdrv_open2(blkdev->bs, blkdev->filename, qflags,
+                            bdrv_find_format(blkdev->fileproto)) != 0) {
+                    bdrv_delete(blkdev->bs);
+                    blkdev->bs = NULL;
+                }
+            }
        if (!blkdev->bs)
            return -1;

Xen-devel mailing list



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