aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarno Rajahalme <jrajahalme@nicira.com>2014-11-03 11:23:11 -0800
committerJarno Rajahalme <jrajahalme@nicira.com>2014-11-06 15:03:48 -0800
commit01c0f83a4ff46aebb57d175ba23b1a3fe6bd0dda (patch)
treea8a287e896f1e0f221ee626c6b86ef746b8b16ee
parentf80028fe28bf2d73e3e4e470e2d5f9ccb5ece9a7 (diff)
classifier: Clean up destroy_subtable.
Add asserts to make sure the containers within are already empty. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
-rw-r--r--lib/classifier.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/classifier.c b/lib/classifier.c
index 64d0786f5..82aaf3efa 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -1080,6 +1080,7 @@ insert_subtable(struct classifier *cls, const struct minimask *mask)
return subtable;
}
+/* RCU readers may still access the subtable before it is actually freed. */
static void
destroy_subtable(struct classifier *cls, struct cls_subtable *subtable)
OVS_REQUIRES(cls->mutex)
@@ -1087,13 +1088,16 @@ destroy_subtable(struct classifier *cls, struct cls_subtable *subtable)
int i;
pvector_remove(&cls->subtables, subtable);
- trie_destroy(&subtable->ports_trie);
+ cmap_remove(&cls->subtables_map, &subtable->cmap_node,
+ minimask_hash(&subtable->mask, 0));
+
+ ovs_assert(ovsrcu_get_protected(struct trie_node *, &subtable->ports_trie)
+ == NULL);
+ ovs_assert(cmap_is_empty(&subtable->rules));
for (i = 0; i < subtable->n_indices; i++) {
cmap_destroy(&subtable->indices[i]);
}
- cmap_remove(&cls->subtables_map, &subtable->cmap_node,
- minimask_hash(&subtable->mask, 0));
cmap_destroy(&subtable->rules);
ovsrcu_postpone(free, subtable);
}