From patchwork Wed Mar 15 23:01:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 739464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vk6bq4KgZz9rxl for ; Thu, 16 Mar 2017 10:03:51 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 99440B59; Wed, 15 Mar 2017 23:02:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 44935B43 for ; Wed, 15 Mar 2017 23:02:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9D38F141 for ; Wed, 15 Mar 2017 23:01:59 +0000 (UTC) Received: from mfilter2-d.gandi.net (mfilter2-d.gandi.net [217.70.178.140]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 80513A80D1; Thu, 16 Mar 2017 00:01:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mfilter2-d.gandi.net Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter2-d.gandi.net (mfilter2-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id SKFV_LbzJIGB; Thu, 16 Mar 2017 00:01:57 +0100 (CET) X-Originating-IP: 208.91.1.34 Received: from carno.eng.vmware.com (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id C18F2A80C4; Thu, 16 Mar 2017 00:01:55 +0100 (CET) From: Joe Stringer To: dev@openvswitch.org Date: Wed, 15 Mar 2017 16:01:41 -0700 Message-Id: <20170315230141.32414-5-joe@ovn.org> X-Mailer: git-send-email 2.11.1 In-Reply-To: <20170315230141.32414-1-joe@ovn.org> References: <20170315230141.32414-1-joe@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [branch-2.7 4/4] ofproto: Move tun_table and vl_mff_map deletion. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Yi-Hung Wei In this patch, we move the tun_table and vl_mff_map deletion in ofproto_destory__() to be in the following order. 1. Delete all the flows. 2. Delete vl_mff_map. 3. Delete tun_table. The rationale behind this order is that a flow may use a variable length mf_field, and a variable length mf_field is defined by a TLV mapping in tun_table. Signed-off-by: Yi-Hung Wei Signed-off-by: Joe Stringer Acked-by: Jarno Rajahalme --- ofproto/ofproto.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index b00a4af5e5c7..ceb020778d81 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1574,14 +1574,6 @@ ofproto_destroy__(struct ofproto *ofproto) cmap_destroy(&ofproto->groups); hmap_remove(&all_ofprotos, &ofproto->hmap_node); - tun_metadata_free(ovsrcu_get_protected(struct tun_table *, - &ofproto->metadata_tab)); - - ovs_mutex_lock(&ofproto->vl_mff_map.mutex); - mf_vl_mff_map_clear(&ofproto->vl_mff_map, true); - ovs_mutex_unlock(&ofproto->vl_mff_map.mutex); - cmap_destroy(&ofproto->vl_mff_map.cmap); - ovs_mutex_destroy(&ofproto->vl_mff_map.mutex); free(ofproto->name); free(ofproto->type); @@ -1600,6 +1592,14 @@ ofproto_destroy__(struct ofproto *ofproto) } free(ofproto->tables); + ovs_mutex_lock(&ofproto->vl_mff_map.mutex); + mf_vl_mff_map_clear(&ofproto->vl_mff_map, true); + ovs_mutex_unlock(&ofproto->vl_mff_map.mutex); + cmap_destroy(&ofproto->vl_mff_map.cmap); + ovs_mutex_destroy(&ofproto->vl_mff_map.mutex); + tun_metadata_free(ovsrcu_get_protected(struct tun_table *, + &ofproto->metadata_tab)); + ovs_assert(hindex_is_empty(&ofproto->cookies)); hindex_destroy(&ofproto->cookies);