ofproto-dpif-upcall: Fix a race.
Commit
61057e884ca9c(ofproto-dpif-upcall: Slightly simplify
udpif_upcall_handler().) restructured the main loop in
udpif_upcall_handler() and discarded the check for the
'exit_latch' after acquiring the mutex. This makes it
possible for the following race:
- main thread sets the 'exit_latch' after the handler thread
checking it.
- main thread acquires the handler thread mutex and signals the
condition variable of handler thread.
- main thread releases the mutex and 'join' the handler thread.
- handler thread acquires the mutex, finds that n_upcalls is 0
and waits on the signal of condition variable.
- then OVS will hang forever.
This commit fixes the above issue by adding a check for the
'exit_latch' after acquiring the mutex.
Bug #1217229
Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>