Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=156a32063baa99... Commit: 156a32063baa99fefdb445c68111b174dc06753e Parent: c77921e6dd8186ffc80b9e3422f3b098d0b778a2 Author: Ryan McCabe rmccabe@redhat.com AuthorDate: Fri Jul 12 15:36:35 2013 -0400 Committer: Ryan McCabe rmccabe@redhat.com CommitterDate: Fri Jul 12 15:36:35 2013 -0400
rgmanager: Fix for double pthread_mutex_unlock() calls
Fix a few places where pthread_mutex_unlock() could be called on an unlocked mutex.
Resolves: rhbz#983296
Signed-off-by: Ryan McCabe rmccabe@redhat.com --- rgmanager/src/clulib/vft.c | 4 ++-- rgmanager/src/daemons/rg_event.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/rgmanager/src/clulib/vft.c b/rgmanager/src/clulib/vft.c index 0a97c61..6013575 100644 --- a/rgmanager/src/clulib/vft.c +++ b/rgmanager/src/clulib/vft.c @@ -1000,7 +1000,6 @@ vf_key_init_nt(const char *keyid, int timeout, vf_vote_cb_t vote_cb, newnode = kn_find_key(keyid); if (newnode) { printf("Key %s already initialized\n", keyid); - pthread_mutex_unlock(&key_list_mutex); return -1; }
@@ -1008,7 +1007,6 @@ vf_key_init_nt(const char *keyid, int timeout, vf_vote_cb_t vote_cb,
if (newnode == NULL) { fprintf(stderr, "malloc fail3 err=%d\n", errno); - pthread_mutex_unlock(&key_list_mutex); return -1; }
@@ -1487,6 +1485,8 @@ vf_read(cluster_member_list_t *membership, const char *keyid, uint64_t *view, pthread_mutex_unlock(&vf_mutex); return l; } + + pthread_mutex_lock(&key_list_mutex); }
if (key_node->kn_datalen && key_node->kn_data) { diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c index 2b78b49..028741f 100644 --- a/rgmanager/src/daemons/rg_event.c +++ b/rgmanager/src/daemons/rg_event.c @@ -338,9 +338,8 @@ event_master(void) //logt_print(LOG_DEBUG, "%d is master\n", mi->m_nodeid); goto out; } - } - - pthread_mutex_unlock(&mi_mutex); + } else + pthread_mutex_unlock(&mi_mutex);
memset(&_master_lock, 0, sizeof(_master_lock)); if (clu_lock(LKM_EXMODE, &_master_lock, LKF_NOQUEUE,
cluster-commits@lists.fedorahosted.org