From 32f61d592afffc031765d9b24d90be9fb8169dca Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Fri, 13 Dec 2013 11:29:09 -0800 Subject: [PATCH] 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 --- ofproto/ofproto-dpif-monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 2.47.0