From: Alex Wang Date: Fri, 13 Dec 2013 19:29:09 +0000 (-0800) Subject: ofproto-dpif-monitor: Acquire write lock in monitor_run(). X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=32f61d592afffc031765d9b24d90be9fb8169dca;p=sliver-openvswitch.git ofproto-dpif-monitor: Acquire write lock in monitor_run(). Commit 307464a1 (ofproto-dpif-monitor: Use heap to order the mport wakeup time.) re-heapifies the heap in monitor_run(). So the monitor_run() should be protected by the write lock, rather than the read lock. This commit fixes the issue. Signed-off-by: Alex Wang Signed-off-by: Ben Pfaff --- diff --git a/ofproto/ofproto-dpif-monitor.c b/ofproto/ofproto-dpif-monitor.c index 2a833bb93..af66387b7 100644 --- a/ofproto/ofproto-dpif-monitor.c +++ b/ofproto/ofproto-dpif-monitor.c @@ -197,7 +197,7 @@ monitor_run(void) struct ofpbuf packet; ofpbuf_use_stub(&packet, stub, sizeof stub); - ovs_rwlock_rdlock(&monitor_rwlock); + ovs_rwlock_wrlock(&monitor_rwlock); prio_now = MSEC_TO_PRIO(time_msec()); /* Peeks the top of heap and checks if we should run this mport. */ while (!heap_is_empty(&monitor_heap)