From b2941513edc67d63421f5980e568dea8a4b4a617 Mon Sep 17 00:00:00 2001 From: Naphtali Sprei Date: Wed, 7 Apr 2010 16:44:15 -0300 Subject: [PATCH 04/21] read-only: Disable fall-back to read-only RH-Author: Naphtali Sprei Message-id: <1270658667-14294-5-git-send-email-nsprei@redhat.com> Patchwork-id: 8437 O-Subject: [RHEL6 kvm PATCH v3 rebase 04/16] read-only: Disable fall-back to read-only Bugzilla: 537164 RH-Acked-by: Daniel P. Berrange RH-Acked-by: Christoph Hellwig RH-Acked-by: Juan Quintela RH-Acked-by: Kevin Wolf Disable fall-back to read-only when cannot open drive's file for read-write BZ: https://bugzilla.redhat.com/show_bug.cgi?id=537164 upstream commit: 03cbdac7efc20994d0a87015e24e835d0139df7b Signed-off-by: Naphtali Sprei --- block.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) Signed-off-by: Eduardo Habkost --- block.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/block.c b/block.c index 50f52b8..955cd67 100644 --- a/block.c +++ b/block.c @@ -444,8 +444,6 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE)) bs->enable_write_cache = 1; - /* Note: for compatibility, we open disk image files as RDWR, and - RDONLY as fallback */ bs->read_only = (flags & BDRV_O_RDWR) == 0; if (!(flags & BDRV_O_FILE)) { open_flags = (flags & (BDRV_O_RDWR | BDRV_O_CACHE_MASK|BDRV_O_NATIVE_AIO)); @@ -459,10 +457,6 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, ret = -ENOTSUP; } else { ret = drv->bdrv_open(bs, filename, open_flags); - if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) { - ret = drv->bdrv_open(bs, filename, open_flags & ~BDRV_O_RDWR); - bs->read_only = 1; - } } if (ret < 0) { qemu_free(bs->opaque); -- 1.7.0.3