bridge: Fix bug where IDL wakeup causes 100% CPU.
authorJoe Stringer <joestringer@nicira.com>
Mon, 29 Sep 2014 18:09:57 +0000 (18:09 +0000)
committerJoe Stringer <joestringer@nicira.com>
Mon, 29 Sep 2014 18:52:08 +0000 (07:52 +1300)
commitba8ec11566e9d1862d88723dff0ab2378677db37
tree3c4d22a439bc94babc0bb241e0543ddc2dbba0d9
parent09853482b9c3e067a838918b3ee3ecc23cf529f6
bridge: Fix bug where IDL wakeup causes 100% CPU.

Commit 9c537baf613a16e (bridge: Refactor the stats and status update.)
inadvertently changed the way that the status transaction is destroyed,
which could cause the main thread to constantly wake up.

The bug occurs when ovsdb_idl_txn_commit() returns TXN_INCOMPLETE and
there are no further changes to connectivity or 'status_txn_try_again'.

- ovsdb_idl_run() receives the transaction reply and updates the
  transaction status to TXN_SUCCESS.
- status_update_wait() detects that the transaction is in progress, and
  the status is TXN_SUCCESS so wakes up the main thread immediately.
- run_status_update() is meant to destroy the transaction now that it is
  finished, however the logic is never run because there were no changes.
- Repeat the wakeup every time the main loop runs.

This patch fixes the behaviour by ensuring that ovsdb_idl_txn_commit()
gets a chance to run whenever there is an ongoing status transaction.

Bug was found by unloading and reloading the kernel module, then
immediately restarting ovs-vswitchd.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
vswitchd/bridge.c