From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZV3w-0003Fi-3f for qemu-devel@nongnu.org; Thu, 24 Oct 2013 20:15:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VZV3m-0000MX-3P for qemu-devel@nongnu.org; Thu, 24 Oct 2013 20:15:36 -0400 Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:62214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VZV3l-0000MP-Oh for qemu-devel@nongnu.org; Thu, 24 Oct 2013 20:15:26 -0400 Received: by mail-wg0-f47.google.com with SMTP id c11so3125094wgh.14 for ; Thu, 24 Oct 2013 17:15:23 -0700 (PDT) From: Thibaut LAURENT Date: Fri, 25 Oct 2013 02:15:07 +0200 Message-Id: <1382660107-26518-1-git-send-email-thibaut.laurent@gmail.com> Subject: [Qemu-devel] [PATCH] Fix COR by disabling BDRV_O_COPY_ON_READ before opening the backing_file. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Thibaut LAURENT Since commit 0ebd24e0a203cf2852c310b59fbe050190dc6c8c, bdrv_open_common will throw an error when trying to open a file read-only with the BDRV_O_COPY_ON_READ flag set. Although BDRV_O_RDWR is unset for the backing files, BDRV_O_COPY_ON_READ is still passed on if copy-on-read was requested for the drive. Let's unset this flag too before opening the backing file, or bdrv_open_common will fail. Signed-off-by: Thibaut LAURENT --- block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index fd05a80..4474012 100644 --- a/block.c +++ b/block.c @@ -999,7 +999,8 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp) } /* backing files always opened read-only */ - back_flags = bs->open_flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT); + back_flags = bs->open_flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | + BDRV_O_COPY_ON_READ); ret = bdrv_open(bs->backing_hd, *backing_filename ? backing_filename : NULL, options, -- 1.8.4.1