On Tue, Aug 5, 2025 at 3:10 PM Xavier Simonart <xsimo...@redhat.com> wrote:

> next_cfg updates are used as a way to know if transaction with sb got
> poperly committed.
> Before this patch, next_cfg was only updated if
> ovsdb_idl_loop_commit_and_wait returned
> TXN_SUCCESS, i.e. if there was not new transaction in fly.
>
> We might have had the following case:
> - Loop 1: - A transaction is sent; ovsdb_idl_loop_commit_and_wait return
> -1 (in_progress).
> - Loop 2: - The transaction completes (in ovsdb_idl_loop_run), and a new
> transaction is sent.
>           - ovsdb_idl_loop_commit_and_wait return -1 (new txn is
> in_progress).
>           - next_cfg was not updated despite the fact that the first
> transaction succeeded.
>
> Note that next_cfg is (still) updated when there is no commit in fly, and
> no transaction occurs
> in the loop.
>
> Fixes: a6b0007918f4 ("controller: Remove only commited virtual port
> binding requests.")
> Signed-off-by: Xavier Simonart <xsimo...@redhat.com>
> ---
>  controller/ovn-controller.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
> index 5303c6551..33fa91ee1 100644
> --- a/controller/ovn-controller.c
> +++ b/controller/ovn-controller.c
> @@ -6366,6 +6366,7 @@ main(int argc, char *argv[])
>      VLOG_INFO("OVN internal version is : [%s]", ovn_version);
>
>      /* Main loop. */
> +    int ovnsb_txn_status = 1;
>      bool sb_monitor_all = false;
>      struct tracked_acl_ids *tracked_acl_ids = NULL;
>      while (!exit_args.exiting) {
> @@ -6416,6 +6417,13 @@ main(int argc, char *argv[])
>              = ovsdb_idl_loop_run(&ovnsb_idl_loop);
>          unsigned int new_ovnsb_cond_seqno
>              = ovsdb_idl_get_condition_seqno(ovnsb_idl_loop.idl);
> +        if (ovnsb_idl_txn && ovnsb_txn_status == -1) {
> +            if (ovnsb_idl_loop.next_cfg == INT64_MAX) {
> +                ovnsb_idl_loop.next_cfg = 0;
> +            } else {
> +                ovnsb_idl_loop.next_cfg++;
> +            }
> +        }
>          if (new_ovnsb_cond_seqno != ovnsb_cond_seqno) {
>              if (!new_ovnsb_cond_seqno) {
>                  VLOG_INFO("OVNSB IDL reconnected, force recompute.");
> @@ -6880,7 +6888,7 @@ main(int argc, char *argv[])
>              poll_immediate_wake();
>          }
>
> -        int ovnsb_txn_status =
> ovsdb_idl_loop_commit_and_wait(&ovnsb_idl_loop);
> +        ovnsb_txn_status =
> ovsdb_idl_loop_commit_and_wait(&ovnsb_idl_loop);
>          if (!ovnsb_txn_status) {
>              VLOG_INFO("OVNSB commit failed, force recompute next time.");
>              engine_set_force_recompute_immediate();
> --
> 2.47.1
>
>
Thank you Xavier,

I have added the following diff and applied this into main.
As we have discussed offline could you please prepare custom
backport for the series?

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 33fa91ee1..945952c5c 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -5735,6 +5735,16 @@ br_int_remote_update(struct br_int_remote *remote,
     remote->probe_interval = MIN(probe_interval / 1000, INT_MAX);
 }

+static void
+ovsdb_idl_loop_next_cfg_inc(struct ovsdb_idl_loop *idl_loop)
+{
+    if (idl_loop->next_cfg == INT64_MAX) {
+        idl_loop->next_cfg = 0;
+    } else {
+        idl_loop->next_cfg++;
+    }
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -6418,11 +6428,7 @@ main(int argc, char *argv[])
         unsigned int new_ovnsb_cond_seqno
             = ovsdb_idl_get_condition_seqno(ovnsb_idl_loop.idl);
         if (ovnsb_idl_txn && ovnsb_txn_status == -1) {
-            if (ovnsb_idl_loop.next_cfg == INT64_MAX) {
-                ovnsb_idl_loop.next_cfg = 0;
-            } else {
-                ovnsb_idl_loop.next_cfg++;
-            }
+            ovsdb_idl_loop_next_cfg_inc(&ovnsb_idl_loop);
         }
         if (new_ovnsb_cond_seqno != ovnsb_cond_seqno) {
             if (!new_ovnsb_cond_seqno) {
@@ -6893,11 +6899,7 @@ main(int argc, char *argv[])
             VLOG_INFO("OVNSB commit failed, force recompute next time.");
             engine_set_force_recompute_immediate();
         } else if (ovnsb_txn_status == 1) {
-            if (ovnsb_idl_loop.next_cfg == INT64_MAX) {
-                ovnsb_idl_loop.next_cfg = 0;
-            } else {
-                ovnsb_idl_loop.next_cfg++;
-            }
+            ovsdb_idl_loop_next_cfg_inc(&ovnsb_idl_loop);
         } else if (ovnsb_txn_status == -1) {
             /* The commit is still in progress */
         } else {

Regards,
Ales
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to