From aa77020c361ffba011d7ec9603caa55aaa01cd1f Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Tue, 17 May 2011 13:47:23 -0700 Subject: [PATCH] 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. --- lib/bond.c | 4 ++++ lib/netdev.c | 9 +++++++++ lib/netdev.h | 1 + 3 files changed, 14 insertions(+) diff --git a/lib/bond.c b/lib/bond.c index 929d68236..cf1d05718 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 771db5a5a..01d91dbb2 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 30bcf5ecc..81d74ae31 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 -- 2.43.0