From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3sUj-0005Na-Gw for qemu-devel@nongnu.org; Thu, 16 Jan 2014 14:20:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W3sUd-0008JK-IN for qemu-devel@nongnu.org; Thu, 16 Jan 2014 14:20:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44244) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3sUd-0008JA-A4 for qemu-devel@nongnu.org; Thu, 16 Jan 2014 14:20:43 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0GJKe6E001807 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 16 Jan 2014 14:20:41 -0500 Date: Thu, 16 Jan 2014 14:20:37 -0500 From: Jeff Cody Message-ID: <20140116192037.GA1485@localhost.localdomain> References: <2fb3ea05d2e1ee06d578a0f2c53f56df1661401c.1389726691.git.jcody@redhat.com> <20140116093930.GA3369@dhcp-200-207.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140116093930.GA3369@dhcp-200-207.str.redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: do not allow read-only=on and snapshot=on to be used together List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Thu, Jan 16, 2014 at 10:39:30AM +0100, Kevin Wolf wrote: > Am 14.01.2014 um 20:12 hat Jeff Cody geschrieben: > > Having both read-only=on and snapshot=on together does not make sense; > > currently, the read-only argument is effectively ignored for the > > temporary snapshot. To prevent confusion, disallow the usage of both > > 'snapshot=on' and 'read-only=on'. > > > > Signed-off-by: Jeff Cody > > I believe the reason why this was allowed was so that you can use a > read-only file with -snapshot. It might not be necessary any more since > I switched -snapshot implementation to modify the options QDict instead > of manually doing a second bdrv_open(). > > Did you test that this still works now? > Yes, that still works. > The other question is about this code in bdrv_open_flags(): > > /* > * Snapshots should be writable. > */ > if (bs->is_temporary) { > open_flags |= BDRV_O_RDWR; > } > > Is this dead code now because the flag is always already set? > Yes, that ends up being dead code. From later in blockdev_init(): bdrv_flags |= ro ? 0 : BDRV_O_RDWR; QINCREF(bs_opts); ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error); And ro is set from the read-only QemuOpts, that we check in this patch in conjunction with snapshot. So if read-only=on is not specified, it is opened r/w by default.