Blame SOURCES/kvm-block-Disable-BDRV_O_COPY_ON_READ-for-the-backing-fi.patch

218e99
From 01a2d73852aa716e9e57ca9726f967f5e801d6f5 Mon Sep 17 00:00:00 2001
218e99
From: Kevin Wolf <kwolf@redhat.com>
218e99
Date: Tue, 5 Nov 2013 14:09:18 +0100
218e99
Subject: [PATCH 65/87] block: Disable BDRV_O_COPY_ON_READ for the backing file
218e99
218e99
RH-Author: Kevin Wolf <kwolf@redhat.com>
218e99
Message-id: <1383660558-32096-25-git-send-email-kwolf@redhat.com>
218e99
Patchwork-id: 55403
218e99
O-Subject: [RHEL-7.0 qemu-kvm PATCH 24/24] block: Disable BDRV_O_COPY_ON_READ for the backing file
218e99
Bugzilla: 978402
218e99
RH-Acked-by: Fam Zheng <famz@redhat.com>
218e99
RH-Acked-by: Max Reitz <mreitz@redhat.com>
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
218e99
From: Thibaut LAURENT <thibaut.laurent@gmail.com>
218e99
218e99
Since commit 0ebd24e0a203cf2852c310b59fbe050190dc6c8c,
218e99
bdrv_open_common will throw an error when trying to open a file
218e99
read-only with the BDRV_O_COPY_ON_READ flag set.
218e99
Although BDRV_O_RDWR is unset for the backing files,
218e99
BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested
218e99
for the drive. Let's unset this flag too before opening the backing
218e99
file, or bdrv_open_common will fail.
218e99
218e99
Signed-off-by: Thibaut LAURENT <thibaut.laurent@gmail.com>
218e99
Reviewed-by: Benoit Canet <benoit@irqsave.net>
218e99
Reviewed-by: Max Reitz <mreitz@redhat.com>
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
(cherry picked from commit 87a5debd3161d24a7d4c685e3c0d8765b5d92a74)
218e99
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
---
218e99
 block.c | 3 ++-
218e99
 1 file changed, 2 insertions(+), 1 deletion(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 block.c |    3 ++-
218e99
 1 files changed, 2 insertions(+), 1 deletions(-)
218e99
218e99
diff --git a/block.c b/block.c
218e99
index 01c11ee..beeb600 100644
218e99
--- a/block.c
218e99
+++ b/block.c
218e99
@@ -968,7 +968,8 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
218e99
     }
218e99
 
218e99
     /* backing files always opened read-only */
218e99
-    back_flags = bs->open_flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT);
218e99
+    back_flags = bs->open_flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT |
218e99
+                                    BDRV_O_COPY_ON_READ);
218e99
 
218e99
     ret = bdrv_open(bs->backing_hd,
218e99
                     *backing_filename ? backing_filename : NULL, options,
218e99
-- 
218e99
1.7.1
218e99