From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQzFP-000340-KZ for qemu-devel@nongnu.org; Thu, 26 Feb 2015 09:17:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQzFL-0002yG-4k for qemu-devel@nongnu.org; Thu, 26 Feb 2015 09:17:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51514) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQzFK-0002xt-NS for qemu-devel@nongnu.org; Thu, 26 Feb 2015 09:16:59 -0500 Message-ID: <54EF2A7D.50703@redhat.com> Date: Thu, 26 Feb 2015 15:15:25 +0100 From: Paolo Bonzini 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> <54EBA39B.2080002@redhat.com> In-Reply-To: <54EBA39B.2080002@redhat.com> Content-Type: text/plain; charset=iso-8859-15 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: Max Reitz , Wen Congyang , qemu devel , Kevin Wolf , Stefan Hajnoczi Cc: Lai Jiangshan , Jiang Yunhong , Dong Eddie , "Dr. David Alan Gilbert" , Gonglei , Yang Hongyang , zhanghailiang On 23/02/2015 23:03, Max Reitz wrote: > 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. I agree. Perhaps blkcolo_open or colo_svm_init can take care of setting BDRV_O_RDWR on the backing file? They could also use bdrv_reopen. Paolo > 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); >