From patchwork Thu Jul 25 15:18:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 261767 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6D0EC2C00DC for ; Fri, 26 Jul 2013 01:22:13 +1000 (EST) Received: from localhost ([::1]:54704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2NLh-0005xu-Q9 for incoming@patchwork.ozlabs.org; Thu, 25 Jul 2013 11:21:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54279) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2NJl-0003Ln-Lm for qemu-devel@nongnu.org; Thu, 25 Jul 2013 11:19:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2NJi-0003Wu-Br for qemu-devel@nongnu.org; Thu, 25 Jul 2013 11:19:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2NJh-0003Wl-Vo; Thu, 25 Jul 2013 11:18:58 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6PFIX5S018568 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 25 Jul 2013 11:18:33 -0400 Received: from localhost (ovpn-112-33.ams2.redhat.com [10.36.112.33]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r6PFIWFI007645; Thu, 25 Jul 2013 11:18:33 -0400 From: Stefan Hajnoczi To: Date: Thu, 25 Jul 2013 17:18:08 +0200 Message-Id: <1374765505-14356-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1374765505-14356-1-git-send-email-stefanha@redhat.com> References: <1374765505-14356-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Ping Fan Liu , alex@alex.org.uk, Michael Roth , qemu-stable@nongnu.org, Stefan Hajnoczi , Paolo Bonzini Subject: [Qemu-devel] [PATCH v6 01/18] block: ensure bdrv_drain_all() works during bdrv_delete() 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 In bdrv_delete() make sure to call bdrv_make_anon() *after* bdrv_close() so that the device is still seen by bdrv_drain_all() when iterating bdrv_states. Cc: qemu-stable@nongnu.org Signed-off-by: Stefan Hajnoczi Reviewed-by: Wenchao Xia --- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index 6cd39fa..9d68270 100644 --- a/block.c +++ b/block.c @@ -1600,11 +1600,11 @@ void bdrv_delete(BlockDriverState *bs) assert(!bs->job); assert(!bs->in_use); + bdrv_close(bs); + /* remove from list, if necessary */ bdrv_make_anon(bs); - bdrv_close(bs); - g_free(bs); }