[ovs-dev] [branch-2.7 4/4] ofproto: Move tun_table and vl_mff_map deletion.

Joe Stringer joe at ovn.org
Wed Mar 15 23:01:41 UTC 2017


From: Yi-Hung Wei <yihung.wei at gmail.com>

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 <yihung.wei at gmail.com>
Signed-off-by: Joe Stringer <joe at ovn.org>
---
 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);
 
-- 
2.11.1



More information about the dev mailing list