[ovs-dev] [PATCH] ofproto-dpif: Delete system tunnel interface when remove ovs bridge

Eric Garver e at erig.me
Thu Oct 26 14:24:46 UTC 2017


On Wed, Oct 25, 2017 at 11:41:27AM +0800, juyan at redhat.com wrote:
> When there is only one bridge,create tunnel in the bridge,
> then delete the bridge directly. the system tunnel interface
> still in.
> 
> Cause of only one bridge, backer->refcount values 1, when
> delete bridge, "close_dpif_backer" will delete the backer,
> so type_run will return directly, doesn't delete the interface.
> This patch delete the system interface before free the backer.

I'll add a bit more explanation..

This occurs when a tunnel is created with rtnetlink. With the compat API
the tunnel is created via the vport tunnel interface, so it can be
implicitly cleaned up by the kernel when the dp is closed or the module
unloaded.  But with rtnetlink the kernel module is not involved with the
tunnel device creation (it's added to OVS as a netdev vport), so
userspace needs to explicitly clean up the tunnel backers - type_run
can't garbage collect them if the dpif is already deleted.

> 
> Fixes: 921c370a9df5 ("dpif-netlink: Probe for out-of-tree tunnels, decides used interface")
> Signed-off-by: JunhanYan <juyan at redhat.com>
> ---
>  ofproto/ofproto-dpif.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 43d670a..72993a4 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -646,6 +646,8 @@ dealloc(struct ofproto *ofproto_)
>  static void
>  close_dpif_backer(struct dpif_backer *backer, bool del)
>  {
> +    struct simap_node *node;
> +
>      ovs_assert(backer->refcount > 0);
>  
>      if (--backer->refcount) {
> @@ -654,6 +656,9 @@ close_dpif_backer(struct dpif_backer *backer, bool del)
>  
>      udpif_destroy(backer->udpif);
>  
> +    SIMAP_FOR_EACH (node, &backer->tnl_backers) {
> +        dpif_port_del(backer->dpif, u32_to_odp(node->data));
> +    }
>      simap_destroy(&backer->tnl_backers);
>      ovs_rwlock_destroy(&backer->odp_to_ofport_lock);
>      hmap_destroy(&backer->odp_to_ofport_map);
> -- 
> 2.9.5
> 

I didn't run the testsuite, but this looks okay to me.

Acked-by: Eric Garver <e at erig.me>


More information about the dev mailing list