From: Ethan Jackson Date: Tue, 17 May 2011 20:47:23 +0000 (-0700) Subject: bond: Bonds never sleep if carrier changes. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa77020c361ffba011d7ec9603caa55aaa01cd1f;p=openvswitch bond: Bonds never sleep if carrier changes. The bonding code neglected to call netdev_monitor_poll() on its monitor during bond_run(). Thus carrier changes would be permanently queued in the monitor, preventing it from ever allowing poll_loop to sleep. --- diff --git a/lib/bond.c b/lib/bond.c index 929d6823..cf1d0571 100644 --- a/lib/bond.c +++ b/lib/bond.c @@ -466,6 +466,10 @@ bond_run(struct bond *bond, struct tag_set *tags, bool lacp_negotiated) bond->miimon_next_update = time_msec() + bond->miimon_interval; } + if (bond->monitor) { + netdev_monitor_flush(bond->monitor); + } + /* Enable slaves based on link status and LACP feedback. */ HMAP_FOR_EACH (slave, hmap_node, &bond->slaves) { bond_link_status_update(slave, tags); diff --git a/lib/netdev.c b/lib/netdev.c index 771db5a5..01d91dbb 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -1549,6 +1549,15 @@ netdev_monitor_poll(struct netdev_monitor *monitor, char **devnamep) } } +/* Clears all notifications from 'monitor'. May be called instead of + * netdev_monitor_poll() by clients which don't care specifically which netdevs + * have changed. */ +void +netdev_monitor_flush(struct netdev_monitor *monitor) +{ + sset_clear(&monitor->changed_netdevs); +} + /* Registers with the poll loop to wake up from the next call to poll_block() * when netdev_monitor_poll(monitor) would indicate that a device has * changed. */ diff --git a/lib/netdev.h b/lib/netdev.h index 30bcf5ec..81d74ae3 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -214,6 +214,7 @@ void netdev_monitor_destroy(struct netdev_monitor *); int netdev_monitor_add(struct netdev_monitor *, struct netdev *); void netdev_monitor_remove(struct netdev_monitor *, struct netdev *); int netdev_monitor_poll(struct netdev_monitor *, char **devnamep); +void netdev_monitor_flush(struct netdev_monitor *); void netdev_monitor_poll_wait(const struct netdev_monitor *); #ifdef __cplusplus