From patchwork Mon Feb 10 21:49:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Canet?= X-Patchwork-Id: 319066 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 EC82B2C00AE for ; Tue, 11 Feb 2014 08:49:52 +1100 (EST) Received: from localhost ([::1]:58321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCyjc-0001nx-Jb for incoming@patchwork.ozlabs.org; Mon, 10 Feb 2014 16:49:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCyjI-0001nl-UH for qemu-devel@nongnu.org; Mon, 10 Feb 2014 16:49:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCyjC-00043T-8o for qemu-devel@nongnu.org; Mon, 10 Feb 2014 16:49:28 -0500 Received: from paradis.irqsave.net ([62.212.105.220]:49624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCyjB-00043H-UP for qemu-devel@nongnu.org; Mon, 10 Feb 2014 16:49:22 -0500 Received: from localhost.localdomain (laure.irqsave.net [192.168.77.2]) by paradis.irqsave.net (Postfix) with ESMTP id 02A1D6141B; Mon, 10 Feb 2014 23:26:14 +0100 (CET) From: =?UTF-8?q?Beno=C3=AEt=20Canet?= To: qemu-devel@nongnu.org Date: Mon, 10 Feb 2014 22:49:17 +0100 Message-Id: <1392068957-14184-2-git-send-email-benoit.canet@irqsave.net> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392068957-14184-1-git-send-email-benoit.canet@irqsave.net> References: <1392068957-14184-1-git-send-email-benoit.canet@irqsave.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 62.212.105.220 Cc: kwolf@redhat.com, =?UTF-8?q?Beno=C3=AEt=20Canet?= , famz@redhat.com, Benoit Canet , jcody@redhat.com, armbru@redhat.com, mreitz@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [FIX V2] block: Fix device snapshots broken by the block filter snapshots patchset. 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 Take into account the fact that a block filter like quorum will be in bs->file while a regular block driver device is really on the top level. Signed-off-by: Benoit Canet Reviewed-by: Fam Zheng --- block.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/block.c b/block.c index 07ac50a..d04f535 100644 --- a/block.c +++ b/block.c @@ -5400,14 +5400,16 @@ bool bdrv_is_first_non_filter(BlockDriverState *candidate) /* walk down the bs forest recursively */ QTAILQ_FOREACH(bs, &bdrv_states, device_list) { - bool perm; - - if (!bs->file) { - continue; + bool perm = false; + + if (bs->file && + bs->file->drv && + bs->file->drv->authorizations[BS_IS_A_FILTER]) { + perm = bdrv_recurse_is_first_non_filter(bs->file, candidate); + } else if (bs == candidate) { + perm = true; } - perm = bdrv_recurse_is_first_non_filter(bs->file, candidate); - /* candidate is the first non filter */ if (perm) { return true;