vswitchd: Disable system stats collection on a concurrently running daemon.
authorGurucharan Shetty <gshetty@nicira.com>
Sun, 28 Apr 2013 02:58:12 +0000 (19:58 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Mon, 29 Apr 2013 23:51:33 +0000 (16:51 -0700)
commit25cc6b29523b113e2aa775c4abe01828a1d47fb9
tree817ec63bc1b10c425d231028cf7e9849349fa635
parent4036665e1d47d6fa8aeea196e08048360893ce64
vswitchd: Disable system stats collection on a concurrently running daemon.

There are very rare cases (ex: ovs-vswitchd.pid is inadvertantly deleted),
when multiple ovs-vswitchd daemons can end up running at the same time.
In a situation like that one of the daemons can wait on the poll()
with a 0 ms wait time as it would be expecting system stats to be collected.

But system stats are never run for the daemon that does not have the
lock on the database and hence it takes up 100% of the CPU if its state
machine for stats collection previously was S_WAITING.

With this patch, we disable the system stats collection for the daemon that
does not have the database lock. When it eventually gets the lock on the
database, system stats are automatically enabled if other_config:\
enable-statistics=true.

Bug #16669.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
vswitchd/bridge.c