From patchwork Wed Dec 10 10:34:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 419555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ED8F514009B for ; Wed, 10 Dec 2014 21:54:12 +1100 (AEDT) Received: from localhost ([::1]:44619 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyeuI-00078i-VR for incoming@patchwork.ozlabs.org; Wed, 10 Dec 2014 05:54:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyecC-0000cT-CX for qemu-devel@nongnu.org; Wed, 10 Dec 2014 05:35:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xyec6-00087I-7o for qemu-devel@nongnu.org; Wed, 10 Dec 2014 05:35:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xyec5-00086r-W3 for qemu-devel@nongnu.org; Wed, 10 Dec 2014 05:35:22 -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 sBAAZLDL007359 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 10 Dec 2014 05:35:21 -0500 Received: from noname.str.redhat.com (dhcp-192-197.str.redhat.com [10.33.192.197]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sBAAYeSM016328; Wed, 10 Dec 2014 05:35:20 -0500 From: Kevin Wolf To: qemu-devel@nongnu.org Date: Wed, 10 Dec 2014 11:34:07 +0100 Message-Id: <1418207679-32260-42-git-send-email-kwolf@redhat.com> In-Reply-To: <1418207679-32260-1-git-send-email-kwolf@redhat.com> References: <1418207679-32260-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com Subject: [Qemu-devel] [PULL 41/73] blockdev: check for BLOCK_OP_TYPE_INTERNAL_SNAPSHOT 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Hajnoczi The BLOCK_OP_TYPE_INTERNAL_SNAPSHOT op blocker exists but was never used! Let's fix that so internal snapshots can be blocked. [Fixed s/external/internal/ typo as pointed out by Paolo Bonzini and Max Reitz. --Stefan] Signed-off-by: Stefan Hajnoczi Reviewed-by: Max Reitz Message-id: 1416566940-4430-5-git-send-email-stefanha@redhat.com Signed-off-by: Kevin Wolf --- blockdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/blockdev.c b/blockdev.c index ea59c39..5651a8e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1250,6 +1250,10 @@ static void internal_snapshot_prepare(BlkTransactionState *common, return; } + if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_INTERNAL_SNAPSHOT, errp)) { + return; + } + if (bdrv_is_read_only(bs)) { error_set(errp, QERR_DEVICE_IS_READ_ONLY, device); return;