From 78312b070220d747feb96a61a7794b40aec15c6e Mon Sep 17 00:00:00 2001 From: Naphtali Sprei Date: Wed, 7 Apr 2010 16:44:17 -0300 Subject: [PATCH 06/21] read_only: Ask for read-write permissions when opening files RH-Author: Naphtali Sprei Message-id: <1270658667-14294-7-git-send-email-nsprei@redhat.com> Patchwork-id: 8439 O-Subject: [RHEL6 kvm PATCH v3 rebase 06/16] read_only: Ask for read-write permissions when opening files Bugzilla: 537164 RH-Acked-by: Daniel P. Berrange RH-Acked-by: Christoph Hellwig RH-Acked-by: Juan Quintela RH-Acked-by: Kevin Wolf Found some places that seems needs this explicitly, now that read-write is not the default. BZ: https://bugzilla.redhat.com/show_bug.cgi?id=537164 upstream commit: 058fc8c768f81f9140db511171185dc8e0676163 Signed-off-by: Naphtali Sprei --- block/qcow2.c | 2 +- block/vvfat.c | 2 +- qemu-img.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) Signed-off-by: Eduardo Habkost --- block/qcow2.c | 2 +- block/vvfat.c | 2 +- qemu-img.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 6110076..294b432 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -998,7 +998,7 @@ exit: if (ret == 0 && prealloc) { BlockDriverState *bs; bs = bdrv_new(""); - bdrv_open(bs, filename, BDRV_O_CACHE_WB); + bdrv_open(bs, filename, BDRV_O_CACHE_WB | BDRV_O_RDWR); preallocate(bs); bdrv_close(bs); } diff --git a/block/vvfat.c b/block/vvfat.c index 592d6e6..bb707c0 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -2792,7 +2792,7 @@ static int enable_write_target(BDRVVVFATState *s) if (bdrv_create(bdrv_qcow, s->qcow_filename, options) < 0) return -1; s->qcow = bdrv_new(""); - if (s->qcow == NULL || bdrv_open(s->qcow, s->qcow_filename, 0) < 0) + if (s->qcow == NULL || bdrv_open(s->qcow, s->qcow_filename, BDRV_O_RDWR) < 0) return -1; #ifndef _WIN32 diff --git a/qemu-img.c b/qemu-img.c index 1cd1922..a5fcf2a 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1116,7 +1116,7 @@ static int img_rebase(int argc, char **argv) if (!bs) error("Not enough memory"); - flags = BRDV_O_FLAGS | (unsafe ? BDRV_O_NO_BACKING : 0); + flags = BRDV_O_FLAGS | BDRV_O_RDWR | (unsafe ? BDRV_O_NO_BACKING : 0); if (bdrv_open2(bs, filename, flags, NULL) < 0) { error("Could not open '%s'", filename); } @@ -1157,7 +1157,7 @@ static int img_rebase(int argc, char **argv) } bs_new_backing = bdrv_new("new_backing"); - if (bdrv_open2(bs_new_backing, out_baseimg, BRDV_O_FLAGS, + if (bdrv_open2(bs_new_backing, out_baseimg, BRDV_O_FLAGS | BDRV_O_RDWR, new_backing_drv)) { error("Could not open new backing file '%s'", backing_name); -- 1.7.0.3