bridge: Remove slaves from the bond before closing their netdevs.
authorBen Pfaff <blp@nicira.com>
Thu, 21 Apr 2011 23:37:38 +0000 (16:37 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 21 Apr 2011 23:37:38 +0000 (16:37 -0700)
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

index 3c9b05f3b9d195cd6d586f58eea34d315432609c..20ecca356c960db213e46bdcce4807da540cca24 100644 (file)
@@ -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;
                 }