From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32815) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQ16F-0007Y7-8Y for qemu-devel@nongnu.org; Mon, 23 Feb 2015 17:03:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQ166-0007NK-0S for qemu-devel@nongnu.org; Mon, 23 Feb 2015 17:03:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQ165-0007N6-NN for qemu-devel@nongnu.org; Mon, 23 Feb 2015 17:03:25 -0500 Message-ID: <54EBA39B.2080002@redhat.com> Date: Mon, 23 Feb 2015 17:03:07 -0500 From: Max Reitz MIME-Version: 1.0 References: <1423710438-14377-1-git-send-email-wency@cn.fujitsu.com> <1423710438-14377-12-git-send-email-wency@cn.fujitsu.com> In-Reply-To: <1423710438-14377-12-git-send-email-wency@cn.fujitsu.com> Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH 11/14] allow writing to the backing file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang , qemu devel , Kevin Wolf , Stefan Hajnoczi , Paolo Bonzini Cc: Lai Jiangshan , Jiang Yunhong , Dong Eddie , "Dr. David Alan Gilbert" , Gonglei , Yang Hongyang , zhanghailiang On 2015-02-11 at 22:07, Wen Congyang wrote: > Signed-off-by: Wen Congyang > Signed-off-by: zhanghailiang > Signed-off-by: Gonglei > --- > block.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) I don't think this is a good idea. With this patch, every time you open a COW file (with a backing file) R/W, the backing file will be writable. I'd rather like a way to explicitly overwrite the R/W mode of the backing file; but by default, in my opinion, it should stay read-only. Max > diff --git a/block.c b/block.c > index 067c44b..96cf973 100644 > --- a/block.c > +++ b/block.c > @@ -856,8 +856,8 @@ static int bdrv_inherited_flags(int flags) > */ > static int bdrv_backing_flags(int flags) > { > - /* backing files always opened read-only */ > - flags &= ~(BDRV_O_RDWR | BDRV_O_COPY_ON_READ); > + /* backing files are opened read-write for block replication */ > + flags &= ~BDRV_O_COPY_ON_READ; > > /* snapshot=on is handled on the top layer */ > flags &= ~(BDRV_O_SNAPSHOT | BDRV_O_TEMPORARY);