From patchwork Sat Feb 6 13:36:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alyssa Milburn X-Patchwork-Id: 8242531 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 95B8BBEEE5 for ; Sat, 6 Feb 2016 13:36:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B2C92022A for ; Sat, 6 Feb 2016 13:36:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34CD420212 for ; Sat, 6 Feb 2016 13:36:32 +0000 (UTC) Received: from localhost ([::1]:53740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS32N-0008MK-KS for patchwork-qemu-devel@patchwork.kernel.org; Sat, 06 Feb 2016 08:36:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS32G-0008LM-W5 for qemu-devel@nongnu.org; Sat, 06 Feb 2016 08:36:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aS32G-0002hm-75 for qemu-devel@nongnu.org; Sat, 06 Feb 2016 08:36:24 -0500 Received: from li141-249.members.linode.com ([109.74.194.249]:45960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS32B-0002fz-V4; Sat, 06 Feb 2016 08:36:20 -0500 Received: by li141-249.members.linode.com (Postfix, from userid 1000) id 672D879DD; Sat, 6 Feb 2016 13:36:18 +0000 (UTC) Date: Sat, 6 Feb 2016 13:36:18 +0000 From: Alyssa Milburn To: qemu-devel@nongnu.org Message-ID: <20160206133618.GA16635@li141-249.members.linode.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 109.74.194.249 Cc: Kevin Wolf , Markus Armbruster , qemu-block@nongnu.org Subject: [Qemu-devel] [PATCH v2] blockdev: unset inappropriate flags when changing medium X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Most importantly, this removes BDRV_O_TEMPORARY, to avoid unlink()ing an image which replaces a snapshotted one. Signed-off-by: Alyssa Milburn --- blockdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blockdev.c b/blockdev.c index be4ca44..a916b06 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2514,6 +2514,8 @@ void qmp_blockdev_change_medium(const char *device, const char *filename, } bdrv_flags = blk_get_open_flags_from_root_state(blk); + bdrv_flags &= ~(BDRV_O_TEMPORARY | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING | + BDRV_O_PROTOCOL); if (!has_read_only) { read_only = BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN;