diff mbox series

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

Message ID 20220906111208.2341148-1-amusil@redhat.com
State Accepted
Headers show
Series [ovs-dev] northd: Properly check the wakeup time in MAC banding aging | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Ales Musil Sept. 6, 2022, 11:12 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>
---
 northd/mac-binding-aging.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Han Zhou Sept. 9, 2022, 6:09 a.m. UTC | #1
On Tue, Sep 6, 2022 at 4:12 AM Ales Musil <amusil@redhat.com> wrote:
>
> 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>
> ---
>  northd/mac-binding-aging.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> 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");
> --
> 2.37.2
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Thanks Ales. Applied to main and branch-22.09.

Han
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");