]> xenbits.xensource.com Git - qemu-xen-4.0-testing.git/commitdiff
stubdom: fix read-only disks access
authorKeir Fraser <kfraser@endor.localdomain>
Mon, 4 Aug 2008 10:08:09 +0000 (11:08 +0100)
committerKeir Fraser <kfraser@endor.localdomain>
Mon, 4 Aug 2008 10:08:09 +0000 (11:08 +0100)
There is no need for a flush on read-only disks.  It would actually even
error out and disturb the guest.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
block-vbd.c

index a3465b748adbc22b2143667b2feec16feda37758..58015bdf007e70e7c8e0455ed78c92388a46708e 100644 (file)
@@ -273,6 +273,10 @@ static BlockDriverAIOCB *vbd_aio_flush(BlockDriverState *bs,
     BDRVVbdState *s = bs->opaque;
     VbdAIOCB *acb = NULL;
 
+    if (s->info.mode == O_RDONLY) {
+        cb(opaque, 0);
+        return NULL;
+    }
     if (s->info.barrier == 1) {
         acb = vbd_aio_setup(bs, 0, NULL, 0,
                 s->info.flush == 1 ? vbd_nop_cb : cb, opaque);