From 3109f49d6eee43693a4e187f0e81ba831b3212a4 Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Sun, 28 Sep 2014 17:54:17 -0700 Subject: [PATCH] bridge: Skip statistics update if cannot get ovsdb config. Commit 62c5c3e (bridge: Rate limit the statistics update.) makes ovs try committing the statistics even if ovs failed to get ovsdb configuration. This causes the ovs committing the NULL transaction pointer. To fix this issue, this commit makes ovs skip statistics update if it cannot get ovsdb config. VMware-BZ: #1331308 Signed-off-by: Alex Wang Acked-by: Ben Pfaff --- vswitchd/bridge.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 656182f13..d2643a037 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -2389,32 +2389,30 @@ bridge_run(void) } /* Refresh interface and mirror stats if necessary. */ - if (time_msec() >= stats_timer) { + if (time_msec() >= stats_timer && cfg) { enum ovsdb_idl_txn_status status; /* Rate limit the update. Do not start a new update if the * previous one is not done. */ if (!stats_txn) { - if (cfg) { - stats_txn = ovsdb_idl_txn_create(idl); - HMAP_FOR_EACH (br, node, &all_bridges) { - struct port *port; - struct mirror *m; - - HMAP_FOR_EACH (port, hmap_node, &br->ports) { - struct iface *iface; - - LIST_FOR_EACH (iface, port_elem, &port->ifaces) { - iface_refresh_stats(iface); - } - port_refresh_stp_stats(port); - } - HMAP_FOR_EACH (m, hmap_node, &br->mirrors) { - mirror_refresh_stats(m); + stats_txn = ovsdb_idl_txn_create(idl); + HMAP_FOR_EACH (br, node, &all_bridges) { + struct port *port; + struct mirror *m; + + HMAP_FOR_EACH (port, hmap_node, &br->ports) { + struct iface *iface; + + LIST_FOR_EACH (iface, port_elem, &port->ifaces) { + iface_refresh_stats(iface); } + port_refresh_stp_stats(port); + } + HMAP_FOR_EACH (m, hmap_node, &br->mirrors) { + mirror_refresh_stats(m); } - refresh_controller_status(); } + refresh_controller_status(); } status = ovsdb_idl_txn_commit(stats_txn); -- 2.20.1