[ovs-dev] [PATCH] ovn: Properly set the index for chassis lookup

Dumitru Ceara dceara at redhat.com
Fri May 24 21:14:01 UTC 2019


On Thu, May 23, 2019 at 10:58 PM Ben Pfaff <blp at ovn.org> wrote:
>
> On Thu, May 23, 2019 at 01:11:46PM -0700, Han Zhou wrote:
> > On Thu, May 9, 2019 at 1:09 AM Dumitru Ceara <dceara at redhat.com> wrote:
> > >
> > > The chassis_lookup_by_name function now calls
> > > sbrec_chassis_index_set_name instead of sbrec_chassis_set_name. Due to
> > > the use of the wrong API memory was leaked every time a chassis was
> > > looked up by name. This was mostly visible when chassis lookups had to
> > > be done continuously (e.g., when two chassis were misconfigured
> > > with the same system-id).
> > >
> > > Reported-at: https://bugzilla.redhat.com/1698462
> > > Reported-by: Alexander <alerom at rambler.ru>
> > > Signed-off-by: Dumitru Ceara <dceara at redhat.com>
> > > ---
> > >  ovn/lib/chassis-index.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/ovn/lib/chassis-index.c b/ovn/lib/chassis-index.c
> > > index 34d4a31..423eeee 100644
> > > --- a/ovn/lib/chassis-index.c
> > > +++ b/ovn/lib/chassis-index.c
> > > @@ -30,7 +30,7 @@ chassis_lookup_by_name(struct ovsdb_idl_index
> > *sbrec_chassis_by_name,
> > >  {
> > >      struct sbrec_chassis *target = sbrec_chassis_index_init_row(
> > >          sbrec_chassis_by_name);
> > > -    sbrec_chassis_set_name(target, name);
> > > +    sbrec_chassis_index_set_name(target, name);
> > >
> > >      struct sbrec_chassis *retval = sbrec_chassis_index_find(
> > >          sbrec_chassis_by_name, target);
> > > --
> > > 1.8.3.1
> > >
> > > _______________________________________________
> > > dev mailing list
> > > dev at openvswitch.org
> > > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
> > Thanks Dumitru for fixing this. I see same wrong way of using index in the
> > same file:
> >
> >     struct sbrec_ha_chassis_group *target =
> >         sbrec_ha_chassis_group_index_init_row(sbrec_ha_chassis_grp_by_name);
> >     sbrec_ha_chassis_group_set_name(target, name);
> >
> > May it be fixed together?
> > I did check all the other files under ovn, and it seems these are the only
> > places with this problem.
> >
> > Acked-by: Han Zhou <hzhou8 at ebay.com>
>
> I folded in the additional fix and applied this to master.  Thank you!

Thanks Han for the additional fix (I completely missed it) and thanks
Ben for applying it!

Cheers,
Dumitru

>
> Here is the final version:
>
> --8<--------------------------cut here-------------------------->8--
>
> From: Dumitru Ceara <dceara at redhat.com>
> Date: Thu, 9 May 2019 10:09:23 +0200
> Subject: [PATCH] ovn: Properly set the index for chassis lookup
>
> The chassis_lookup_by_name function now calls
> sbrec_chassis_index_set_name instead of sbrec_chassis_set_name. Due to
> the use of the wrong API memory was leaked every time a chassis was
> looked up by name. This was mostly visible when chassis lookups had to
> be done continuously (e.g., when two chassis were misconfigured
> with the same system-id).
>
> Acked-by: Han Zhou <hzhou8 at ebay.com>
> Reported-at: https://bugzilla.redhat.com/1698462
> Reported-by: Alexander <alerom at rambler.ru>
> Signed-off-by: Dumitru Ceara <dceara at redhat.com>
> Signed-off-by: Ben Pfaff <blp at ovn.org>
> ---
>  ovn/lib/chassis-index.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ovn/lib/chassis-index.c b/ovn/lib/chassis-index.c
> index 34d4a31eb339..10f70fb4a18f 100644
> --- a/ovn/lib/chassis-index.c
> +++ b/ovn/lib/chassis-index.c
> @@ -30,7 +30,7 @@ chassis_lookup_by_name(struct ovsdb_idl_index *sbrec_chassis_by_name,
>  {
>      struct sbrec_chassis *target = sbrec_chassis_index_init_row(
>          sbrec_chassis_by_name);
> -    sbrec_chassis_set_name(target, name);
> +    sbrec_chassis_index_set_name(target, name);
>
>      struct sbrec_chassis *retval = sbrec_chassis_index_find(
>          sbrec_chassis_by_name, target);
> @@ -55,7 +55,7 @@ ha_chassis_group_lookup_by_name(
>  {
>      struct sbrec_ha_chassis_group *target =
>          sbrec_ha_chassis_group_index_init_row(sbrec_ha_chassis_grp_by_name);
> -    sbrec_ha_chassis_group_set_name(target, name);
> +    sbrec_ha_chassis_group_index_set_name(target, name);
>
>      struct sbrec_ha_chassis_group *retval =
>          sbrec_ha_chassis_group_index_find(sbrec_ha_chassis_grp_by_name,
> --
> 2.20.1
>


More information about the dev mailing list