From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Thibault Subject: [PATCH] stubdom: fix read-only disks access Date: Fri, 1 Aug 2008 19:17:50 +0100 Message-ID: <20080801181750.GF4553@implementation.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline 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@lists.xensource.com List-Id: xen-devel@lists.xenproject.org stubdom: fix read-only disks access 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 diff -r 3dedb6209991 tools/ioemu/block-vbd.c --- a/tools/ioemu/block-vbd.c Fri Aug 01 12:18:02 2008 +0100 +++ b/tools/ioemu/block-vbd.c Fri Aug 01 19:16:52 2008 +0100 @@ -273,6 +273,10 @@ static BlockDriverAIOCB *vbd_aio_flush(B 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);