diff mbox series

[ovs-dev,v2,8/8] northd: Properly check the wakeup time in MAC banding aging

Message ID 20221104075729.219169-8-amusil@redhat.com
State Superseded
Headers show
Series [ovs-dev,v2,1/8] northd, controller: Add timestamp column to MAC_Binding table | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success

Commit Message

Ales Musil Nov. 4, 2022, 7:57 a.m. UTC
We shouldn't run the MAC binding aging if the waker did not
expire. This wouldn't cause any issue if the bulk removal limit
is not configured. When the limit is configured and hit there
will be some MAC bindings expired, just waiting for the
bulk removal delay. If something wakes up the aging run earlier
it could remove those rows without respecting the delay.
Add check if we are past the next wake to prevent that.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Han Zhou <hzhou@ovn.org>
---
 northd/mac-binding-aging.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/northd/mac-binding-aging.c b/northd/mac-binding-aging.c
index 0196a116b..f65353a69 100644
--- a/northd/mac-binding-aging.c
+++ b/northd/mac-binding-aging.c
@@ -91,9 +91,12 @@  en_mac_binding_aging_run(struct engine_node *node, void *data OVS_UNUSED)
 {
     const struct engine_context *eng_ctx = engine_get_context();
     struct northd_data *northd_data = engine_get_input_data("northd", node);
+    struct mac_binding_waker *waker =
+        engine_get_input_data("mac_binding_aging_waker", node);
 
     if (!eng_ctx->ovnsb_idl_txn ||
-        !northd_data->features.mac_binding_timestamp) {
+        !northd_data->features.mac_binding_timestamp ||
+        time_msec() < waker->next_wake_msec) {
         return;
     }
 
@@ -101,8 +104,6 @@  en_mac_binding_aging_run(struct engine_node *node, void *data OVS_UNUSED)
     int64_t now = time_wall_msec();
     uint32_t removal_limit = get_removal_limit(node);
     uint32_t removed_n = 0;
-    struct mac_binding_waker *waker =
-        engine_get_input_data("mac_binding_aging_waker", node);
     struct ovsdb_idl_index *sbrec_mac_binding_by_datapath =
         engine_ovsdb_node_get_index(engine_get_input("SB_mac_binding", node),
                                     "sbrec_mac_binding_by_datapath");