From patchwork Fri Sep 28 17:56:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 187851 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9E8BD2C00D5 for ; Sat, 29 Sep 2012 03:57:42 +1000 (EST) Received: from localhost ([::1]:34216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THeom-0002dv-RC for incoming@patchwork.ozlabs.org; Fri, 28 Sep 2012 13:57:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THeoV-0002dc-Gi for qemu-devel@nongnu.org; Fri, 28 Sep 2012 13:57:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THeoT-0007OU-8L for qemu-devel@nongnu.org; Fri, 28 Sep 2012 13:57:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THeoT-0007N8-0N for qemu-devel@nongnu.org; Fri, 28 Sep 2012 13:57:21 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8SHvJQ9018267 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 Sep 2012 13:57:19 -0400 Received: from dhcp-5-188.str.redhat.com (vpn1-7-84.ams2.redhat.com [10.36.7.84]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8SHvF35020617; Fri, 28 Sep 2012 13:57:18 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 28 Sep 2012 19:56:45 +0200 Message-Id: <1348855033-17174-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1348855033-17174-1-git-send-email-kwolf@redhat.com> References: <1348855033-17174-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 02/30] block: after creating a live snapshot, make old image read-only 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: Jeff Cody Currently, after a live snapshot of a drive, the image that has been 'demoted' to be below the new active layer remains r/w. This patch reopens it read-only. Note that we do not check for error on the reopen(), because we will not abort the snapshots if the reopen fails. This patch depends on the bdrv_reopen() series. Signed-off-by: Jeff Cody Signed-off-by: Kevin Wolf --- blockdev.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/blockdev.c b/blockdev.c index e5d450f..0267fa3 100644 --- a/blockdev.c +++ b/blockdev.c @@ -805,6 +805,11 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) QSIMPLEQ_FOREACH(states, &snap_bdrv_states, entry) { /* This removes our old bs from the bdrv_states, and adds the new bs */ bdrv_append(states->new_bs, states->old_bs); + /* We don't need (or want) to use the transactional + * bdrv_reopen_multiple() across all the entries at once, because we + * don't want to abort all of them if one of them fails the reopen */ + bdrv_reopen(states->new_bs, states->new_bs->open_flags & ~BDRV_O_RDWR, + NULL); } /* success */