[ovs-dev] [PATCH] cmap: Fix deadlock with ovs-atomic-pthreads

YAMAMOTO Takashi yamamoto at valinux.co.jp
Mon Jun 2 10:34:42 UTC 2014


In the case of ovs-atomic-pthreads, the previous coding is expanded
into successive atomic_lock__ calls which ends up with deadlock.

Signed-off-by: YAMAMOTO Takashi <yamamoto at valinux.co.jp>
---
 lib/cmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/cmap.c b/lib/cmap.c
index a760235..7892d50 100644
--- a/lib/cmap.c
+++ b/lib/cmap.c
@@ -690,7 +690,9 @@ cmap_replace__(struct cmap_impl *impl, struct cmap_node *node,
         replacement = cmap_node_next_protected(node);
     } else {
         /* 'replacement' takes the position of 'node' in the list. */
-        ovsrcu_init(&replacement->next, cmap_node_next_protected(node));
+        struct cmap_node *next = cmap_node_next_protected(node);
+
+        ovsrcu_init(&replacement->next, next);
     }
 
     struct cmap_node *iter = &b->nodes[slot];
-- 
1.8.3.1




More information about the dev mailing list