@@ -1579,14 +1579,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);
@@ -1605,6 +1597,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);
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> --- ofproto/ofproto.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)