aboutsummaryrefslogtreecommitdiff
path: root/vswitchd/ovs-brcompatd.c
diff options
context:
space:
mode:
authorJustin Pettit <jpettit@nicira.com>2010-01-14 12:20:09 -0800
committerJustin Pettit <jpettit@nicira.com>2010-01-14 13:01:31 -0800
commit5ff22a0642fb299140e7b3e62588be692386c0b8 (patch)
treed10576d35e4a6e8b3410f31ff07ee730b569b624 /vswitchd/ovs-brcompatd.c
parenteb8d3ed67cf66f571973d7ad324e607013c18e44 (diff)
ovs-brcompatd: Don't consume CPU if can't connect to config db
When ovs-brcompatd can't connect to the database, the "ovs" variable is never set. The function "brc_recv_update" takes care of draining brcompat kernel module's netlink messages. When the netlink message comes in to modify the bridge, that function never gets called, so a netlink message always appears to be ready and we consume 100% CPU looping. With this commit, we log a warning and drop the request on the floor. Bug #2373
Diffstat (limited to 'vswitchd/ovs-brcompatd.c')
-rw-r--r--vswitchd/ovs-brcompatd.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c
index 09225439..34162f3e 100644
--- a/vswitchd/ovs-brcompatd.c
+++ b/vswitchd/ovs-brcompatd.c
@@ -978,6 +978,14 @@ brc_recv_update(const struct ovsrec_open_vswitch *ovs)
goto error;
}
+ /* Just drop the request on the floor if a valid configuration
+ * doesn't exist. We don't immediately do this check, because we
+ * want to drain pending netlink messages. */
+ if (!ovs) {
+ VLOG_WARN_RL(&rl, "could not find valid configuration to update");
+ goto error;
+ }
+
switch (genlmsghdr->cmd) {
case BRC_GENL_C_DP_ADD:
handle_bridge_cmd(ovs, buffer, true);
@@ -1180,14 +1188,12 @@ main(int argc, char *argv[])
unixctl_server_run(unixctl);
ovs = ovsrec_open_vswitch_first(idl);
- if (ovs) {
- brc_recv_update(ovs);
- } else if (ovsdb_idl_get_seqno(idl)) {
+ brc_recv_update(ovs);
+
+ if (!ovs && ovsdb_idl_get_seqno(idl)) {
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
VLOG_WARN_RL(&rl, "%s: database does not contain any Open vSwitch "
"configuration", remote);
- } else {
- /* Haven't yet received initial database contents. */
}
netdev_run();