[ovs-dev] [PATCH ovn v2 2/2] lflow.c: Release ref_lflow_node as soon as it is not needed.
Han Zhou
hzhou at ovn.org
Tue Sep 15 18:40:26 UTC 2020
If a resource doesn't have any lflows referencing it any more, the
node ref_lflow_node in lflow_resource_ref.ref_lflow_table should
be removed and released. Otherwise, the table could keep growing
in some scenarios, until a recompute is triggered. Now that the
chance of triggering recompute is lower and there are more resources
references maintained (for type port-binding), this problem is
more likely to happen than before. This patch fixes the problem
by releasing the node as soon as it is not needed.
Fixes: d2aa2c7cafe ("ovn-controller: Maintain resource references for logical flows.")
Signed-off-by: Han Zhou <hzhou at ovn.org>
---
controller/lflow.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/controller/lflow.c b/controller/lflow.c
index 86a5b76..9d54c73 100644
--- a/controller/lflow.c
+++ b/controller/lflow.c
@@ -292,6 +292,10 @@ lflow_resource_destroy_lflow(struct lflow_resource_ref *lfrr,
LIST_FOR_EACH_SAFE (lrln, next, list_node, &lfrn->lflow_ref_head) {
ovs_list_remove(&lrln->list_node);
hmap_remove(&lrln->rlfn->lflow_uuids, &lrln->hmap_node);
+ if (hmap_is_empty(&lrln->rlfn->lflow_uuids)) {
+ hmap_remove(&lfrr->ref_lflow_table, &lrln->rlfn->node);
+ ref_lflow_node_destroy(lrln->rlfn);
+ }
free(lrln);
}
free(lfrn);
--
2.1.0
More information about the dev
mailing list