Received: from eggs.gnu.org ([2001:4830:134:3::10]:53070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbCCm-0006bv-LE for qemu-devel@nongnu.org; Tue, 29 Oct 2013 12:31:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbCCg-0001tE-Kg for qemu-devel@nongnu.org; Tue, 29 Oct 2013 12:31:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41571) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbCCg-0001sx-Aq for qemu-devel@nongnu.org; Tue, 29 Oct 2013 12:31:38 -0400 From: Kevin Wolf Date: Tue, 29 Oct 2013 17:31:07 +0100 Message-Id: <1383064269-27720-16-git-send-email-kwolf@redhat.com> In-Reply-To: <1383064269-27720-1-git-send-email-kwolf@redhat.com> References: <1383064269-27720-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 15/17] 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