On Tue, Sep 3, 2024 at 2:01 PM Xavier Simonart <[email protected]> wrote:

> A small memory leak was possible when exiting ovn-controller while an ovsdb
> transaction was pending.
>
> Signed-off-by: Xavier Simonart <[email protected]>
> ---
>  controller/ovn-controller.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
> index c48667887..9101dfa8d 100644
> --- a/controller/ovn-controller.c
> +++ b/controller/ovn-controller.c
> @@ -5908,7 +5908,22 @@ loop_done:
>              }
>
>              ovsdb_idl_loop_commit_and_wait(&ovnsb_idl_loop);
> -            ovsdb_idl_loop_commit_and_wait(&ovs_idl_loop);
> +            int ovs_txn_status =
> ovsdb_idl_loop_commit_and_wait(&ovs_idl_loop);
> +            if (!ovs_txn_status) {
> +                /* The transaction failed. */
> +                vif_plug_clear_deleted(
> +                        &vif_plug_deleted_iface_ids);
> +                vif_plug_clear_changed(
> +                        &vif_plug_changed_iface_ids);
> +            } else if (ovs_txn_status == 1) {
> +                /* The transaction committed successfully
> +                 * (or it did not change anything in the database). */
> +                vif_plug_finish_deleted(
> +                        &vif_plug_deleted_iface_ids);
> +                vif_plug_finish_changed(
> +                        &vif_plug_changed_iface_ids);
> +            }
> +
>              poll_block();
>          }
>      }
> --
> 2.31.1
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
I'm not happy about the code duplication, because we have
almost the same block a few lines above. However, I don't
have a better idea.

Acked-by: Ales Musil <[email protected]>

-- 

Ales Musil

Senior Software Engineer - OVN Core

Red Hat EMEA <https://www.redhat.com>

[email protected]
<https://red.ht/sig>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to