ofproto-dpif-monitor: Acquire write lock in monitor_run().
authorAlex Wang <alexw@nicira.com>
Fri, 13 Dec 2013 19:29:09 +0000 (11:29 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 17 Dec 2013 23:42:10 +0000 (15:42 -0800)
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 <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif-monitor.c

index 2a833bb..af66387 100644 (file)
@@ -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)