Received: from [140.186.70.92] (port=49058 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OdHds-0000ZA-06 for qemu-devel@nongnu.org; Mon, 26 Jul 2010 02:58:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OdHdm-00049z-ME for qemu-devel@nongnu.org; Mon, 26 Jul 2010 02:58:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6204) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OdHdm-00049r-Dh for qemu-devel@nongnu.org; Mon, 26 Jul 2010 02:58:22 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH] Fix -snapshot deleting images on disk change References: Date: Mon, 26 Jul 2010 08:58:18 +0200 In-Reply-To: (Blue Swirl's message of "Sun, 25 Jul 2010 20:49:34 +0000") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel Blue Swirl writes: > Block device change command did not copy BDRV_O_SNAPSHOT flag. Thus > the new image did not have this flag and the file got deleted during > opening. > > Fix by copying BDRV_O_SNAPSHOT flag. Aha: the file gets deleted because bs->is_temporary survives change, but BDRV_O_SNAPSHOT does not. Thus, the new image gets opened without a snapshot file wrapped around it. But since is_temporary is still true, we attempt to delete the (nonexistant) snapshot file, and end up deleting the image file instead. Your fix makes sense. But I recommend to additionally set bs->is_temporary unconditionally in bdrv_open(). Or get rid of it and test bs->open_flags instead.