While outlining an API change for coroipcc_dispatch_recv,
I noticed that locks are released in two cases in confdb.c,
for which they are not released in nearly identical code in cfg.c's
corosync_cfg_dispatch function.

I don't know enough about the surrounding code and callers/context
to be sure, but it looks like it would mistakenly hold the lock in
these two cases.

Here's a patch to add those pthread_mutex_unlock calls:

>From e255ed0678fb84d87864367e5366a6d3daae5e62 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Fri, 3 Apr 2009 15:56:15 +0200
Subject: [PATCH] confdb.c: add missing mutex-unlock calls after 
coroipcc_dispatch_recv

* lib/confdb.c (confdb_dispatch):
The code in lib/cfg.c's (corosync_cfg_dispatch) is nearly identical
to that in lib/confdb.c's (confdb_dispatch), but lacked two
pthread_mutex_unlock calls.

2009-04-03  Jim Meyering  <[email protected]>
---
 lib/confdb.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/confdb.c b/lib/confdb.c
index 8f76a67..eeba189 100644
--- a/lib/confdb.c
+++ b/lib/confdb.c
@@ -345,9 +345,11 @@ cs_error_t confdb_dispatch (
                }

                if (dispatch_avail == 0 && dispatch_types == 
CONFDB_DISPATCH_ALL) {
+                       pthread_mutex_unlock (&confdb_inst->dispatch_mutex);
                        break; /* exit do while cont is 1 loop */
                } else
                if (dispatch_avail == 0) {
+                       pthread_mutex_unlock (&confdb_inst->dispatch_mutex);
                        continue; /* next poll */
                }

--
1.6.2.rc1.285.gc5f54
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to