If ovn_dp_groups ref_count is decremented when fetching old lflows
during a recalculation we can successfully determine if we can reuse the
flow or not.

Reported-by: Mark Michelson <[email protected]>
Reported-at: https://issues.redhat.com/browse/FDP-2747
Signed-off-by: Jacob Tanenbaum <[email protected]>

diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c
index f21024903..19c939cc1 100644
--- a/northd/lflow-mgr.c
+++ b/northd/lflow-mgr.c
@@ -1053,6 +1053,14 @@ do_ovn_lflow_add(struct lflow_table *lflow_table, size_t 
dp_bitmap_len,
     if (old_lflow) {
         dynamic_bitmap_realloc(&old_lflow->dpg_bitmap, dp_bitmap_len);
         if (old_lflow->sync_state != LFLOW_STALE) {
+
+            struct hmap *dp_groups;
+            enum ovn_datapath_type dp_type =
+                ovn_stage_to_datapath_type(old_lflow->stage);
+            dp_groups = &lflow_table->dp_groups[dp_type];
+            ovn_dp_group_release(dp_groups, old_lflow->dpg);
+            old_lflow->dpg = NULL;
+
             return old_lflow;
         }
         sbuuid = old_lflow->sb_uuid;
@@ -1242,7 +1250,6 @@ sync_lflow_to_sb(struct ovn_lflow *lflow,
 
     if (pre_sync_dpg != lflow->dpg) {
         ovn_dp_group_use(lflow->dpg);
-        ovn_dp_group_release(dp_groups, pre_sync_dpg);
     }
 
     lflow->sync_state = LFLOW_SYNCED;
-- 
2.52.0

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

Reply via email to