The ovn_datapath lflow refs are currently used for logical router
incremental processing. By not clearing them we can cause a race
condition during parallel processing when the ref is used after
being freed by a different thread. Ensure that the refs are cleared
before we do full lflow recompute.

Fixes: 9ec96d0d85b6 ("northd: Add and delete logical routers in en-lflow engine 
node.")
Signed-off-by: Ales Musil <[email protected]>
---
 northd/northd.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/northd/northd.c b/northd/northd.c
index 147f28dd5..8efbf4553 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -19176,6 +19176,7 @@ lflow_reset_northd_refs(struct lflow_input *lflow_input)
     struct ls_stateful_record *ls_stateful_rec;
     struct ovn_lb_datapaths *lb_dps;
     struct ovn_port *op;
+    const struct ovn_datapath *od;
 
     LR_STATEFUL_TABLE_FOR_EACH (lr_stateful_rec,
                                 lflow_input->lr_stateful_table) {
@@ -19200,6 +19201,14 @@ lflow_reset_northd_refs(struct lflow_input 
*lflow_input)
     HMAP_FOR_EACH (lb_dps, hmap_node, lflow_input->lb_datapaths_map) {
         lflow_ref_clear(lb_dps->lflow_ref);
     }
+
+    HMAP_FOR_EACH (od, key_node, &lflow_input->lr_datapaths->datapaths) {
+        lflow_ref_clear(od->datapath_lflows);
+    }
+
+    HMAP_FOR_EACH (od, key_node, &lflow_input->ls_datapaths->datapaths) {
+        lflow_ref_clear(od->datapath_lflows);
+    }
 }
 
 bool
-- 
2.51.0

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

Reply via email to