1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

nlcache: force_add_slave: don't update internal data-structure if not needed

force_add_slave was designed to be called right after the link_set_master
call to override our internal cache and not wait for the kernel and register
the slave/master relationship in our internal data-structures. It turns
out the kernel can be faster than us here. So an additional check is needed
to make sure we don't do duplicate operations that would result in the
slave being removed from an internal data-structure.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2020-06-01 18:12:29 +02:00
parent c44a7a3635
commit 7b56575ebd

View File

@@ -1424,7 +1424,7 @@ class _NetlinkCache:
# structure as well.
old_master = self._slaves_master.get(slave)
if old_master:
if old_master and old_master != master:
try:
self._masters_and_slaves.get(old_master, []).remove(slave)
except: