From: Numan Siddique <[email protected]>

When the lflows in an lflow_ref are unlinked by calling
lflow_ref_unlink_lflows(lflow_ref), the dp_ref counter
for each lflow in the lflow_ref is decremented (by calling
dp_refcnt_release()),  but it is not incremented later
when the same lflow is linked back to the lflow_ref.

This patch fixes it.

Fixes: a623606052ea ("northd: Refactor lflow management into a separate 
module.")
Signed-off-by: Numan Siddique <[email protected]>
---
 northd/lflow-mgr.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c
index 61729e9039..df62cd6ab4 100644
--- a/northd/lflow-mgr.c
+++ b/northd/lflow-mgr.c
@@ -690,19 +690,24 @@ lflow_table_add_lflow(struct lflow_table *lflow_table,
             if (lrn->dpgrp_lflow) {
                 lrn->dpgrp_bitmap = bitmap_clone(dp_bitmap, dp_bitmap_len);
                 lrn->dpgrp_bitmap_len = dp_bitmap_len;
+            } else {
+                lrn->dp_index = od->index;
+            }
+            ovs_list_insert(&lflow->referenced_by, &lrn->ref_list_node);
+            hmap_insert(&lflow_ref->lflow_ref_nodes, &lrn->ref_node, hash);
+        }
 
+        if (!lrn->linked) {
+            if (lrn->dpgrp_lflow) {
+                ovs_assert(lrn->dpgrp_bitmap_len == dp_bitmap_len);
                 size_t index;
                 BITMAP_FOR_EACH_1 (index, dp_bitmap_len, dp_bitmap) {
                     dp_refcnt_use(&lflow->dp_refcnts_map, index);
                 }
             } else {
-                lrn->dp_index = od->index;
                 dp_refcnt_use(&lflow->dp_refcnts_map, lrn->dp_index);
             }
-            ovs_list_insert(&lflow->referenced_by, &lrn->ref_list_node);
-            hmap_insert(&lflow_ref->lflow_ref_nodes, &lrn->ref_node, hash);
         }
-
         lrn->linked = true;
     }
 
-- 
2.43.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to