From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbuUt-0004DX-85 for qemu-devel@nongnu.org; Thu, 31 Oct 2013 11:49:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbuUn-0004Ku-TB for qemu-devel@nongnu.org; Thu, 31 Oct 2013 11:49:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbuUn-0004Kl-LU for qemu-devel@nongnu.org; Thu, 31 Oct 2013 11:49:17 -0400 From: Kevin Wolf Date: Thu, 31 Oct 2013 16:48:29 +0100 Message-Id: <1383234524-372-16-git-send-email-kwolf@redhat.com> In-Reply-To: <1383234524-372-1-git-send-email-kwolf@redhat.com> References: <1383234524-372-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 15/30] block: Disable BDRV_O_COPY_ON_READ for the backing file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: 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 Reviewed-by: Benoit Canet Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block.c b/block.c index 366999b..61795fe 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.1.4