• Daniel Borkmann's avatar
    net: vxlan: convert to act as a pernet subsystem · 783c1463
    Daniel Borkmann authored
    As per suggestion from Eric W. Biederman, vxlan should be using
    {un,}register_pernet_subsys() instead of {un,}register_pernet_device()
    to ensure the vxlan_net structure is initialized before and cleaned
    up after all network devices in a given network namespace i.e. when
    dealing with network notifiers. This is similarly handeled already in
    commit 91e2ff35 ("net: Teach vlans to cleanup as a pernet subsystem")
    and, thus, improves upon fd27e0d4 ("net: vxlan: do not use vxlan_net
    before checking event type"). Just as in 91e2ff35, we do not need
    to explicitly handle deletion of vxlan devices as network namespace
    exit calls dellink on all remaining virtual devices, and
    rtnl_link_unregister() calls dellink on all outstanding devices in that
    network namespace, so we can entirely drop the pernet exit operation
    as well. Moreover, on vxlan module exit, rcu_barrier() is called by
    netns since commit 3a765eda ("netns: Add an explicit rcu_barrier
    to unregister_pernet_{device|subsys}"), so this may be omitted. Tested
    with various scenarios and works well on my side.
    Suggested-by: default avatarEric W. Biederman <ebiederm@xmission.com>
    Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
    Cc: Eric W. Biederman <ebiederm@xmission.com>
    Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    783c1463
vxlan.c 70.9 KB