[ovs-dev] [netdev_monitor 3/4] bridge: Remove slaves from the bond before closing their netdevs.

Ben Pfaff blp at nicira.com
Thu Apr 21 23:39:10 UTC 2011


A bond slave has a pointer to its iface's netdev, so we don't want it to
keep that pointer after the bridge closes the netdev.

This is becoming a bit of a mess so perhaps we need reference counting for
netdevs (although Jesse didn't like the idea when I proposed it before).
---
 vswitchd/bridge.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 3c9b05f..20ecca3 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -664,6 +664,13 @@ bridge_reconfigure(const struct ovsrec_open_vswitch *ovs_cfg)
                     dpif_port = NULL;
                 }
                 if (iface) {
+                    if (iface->port->bond) {
+                        /* The bond has a pointer to the netdev, so remove it
+                         * from the bond before closing the netdev.  The slave
+                         * will get added back to the bond later, after a new
+                         * netdev is available. */
+                        bond_slave_unregister(iface->port->bond, iface);
+                    }
                     netdev_close(iface->netdev);
                     iface->netdev = NULL;
                 }
-- 
1.7.1




More information about the dev mailing list