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

Submitted by Joe Stringer on March 15, 2017, 11:01 p.m.

Details

Message ID 20170315230141.32414-5-joe@ovn.org
State New
Headers show

Commit Message

Joe Stringer March 15, 2017, 11:01 p.m.
From: Yi-Hung Wei <yihung.wei@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@gmail.com>
Signed-off-by: Joe Stringer <joe@ovn.org>
---
 ofproto/ofproto.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

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);