From patchwork Fri Jul 24 10:55:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Hongyang X-Patchwork-Id: 499688 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 E7054140775 for ; Fri, 24 Jul 2015 21:01:01 +1000 (AEST) Received: from localhost ([::1]:44551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIaiq-0000Qe-7f for incoming@patchwork.ozlabs.org; Fri, 24 Jul 2015 07:01:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIaeP-00014z-Fv for qemu-devel@nongnu.org; Fri, 24 Jul 2015 06:56:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIaeO-000073-6p for qemu-devel@nongnu.org; Fri, 24 Jul 2015 06:56:25 -0400 Received: from [59.151.112.132] (port=24346 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIaeM-0008WH-Pm for qemu-devel@nongnu.org; Fri, 24 Jul 2015 06:56:24 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="98817547" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 24 Jul 2015 18:59:55 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t6OAsRp8024393; Fri, 24 Jul 2015 18:54:27 +0800 Received: from localhost (10.167.226.223) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Fri, 24 Jul 2015 18:56:15 +0800 From: Yang Hongyang To: Date: Fri, 24 Jul 2015 18:55:54 +0800 Message-ID: <1437735359-17415-5-git-send-email-yanghy@cn.fujitsu.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437735359-17415-1-git-send-email-yanghy@cn.fujitsu.com> References: <1437735359-17415-1-git-send-email-yanghy@cn.fujitsu.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: jasowang@redhat.com, mrhines@linux.vnet.ibm.com, thuth@redhat.com, stefanha@redhat.com, Yang Hongyang Subject: [Qemu-devel] [PATCH 4/9] filter: remove filter before remove network backend 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 Signed-off-by: Yang Hongyang --- net/net.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/net.c b/net/net.c index c273981..321362f 100644 --- a/net/net.c +++ b/net/net.c @@ -385,9 +385,20 @@ void qemu_del_net_client(NetClientState *nc) { NetClientState *ncs[MAX_QUEUE_NUM]; int queues, i; + QemuOpts *opts; assert(nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC); + if (nc->peer && + nc->peer->info->type == NET_CLIENT_OPTIONS_KIND_FILTER) { + opts = qemu_opts_find(qemu_find_opts_err("netdev", NULL), + nc->peer->name); + assert(opts); + + qemu_del_net_client(nc->peer); + qemu_opts_del(opts); + } + /* If the NetClientState belongs to a multiqueue backend, we will change all * other NetClientStates also. */