cluster: RHEL510 - rgmanager: Fix for double pthread_mutex_unlock() calls
Ryan McCabe
rmccabe at fedoraproject.org
Mon Jul 22 17:01:58 UTC 2013
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=eec46c265deb7704dbf91d3274e4015995268c48
Commit: eec46c265deb7704dbf91d3274e4015995268c48
Parent: 9deeb287a75677409180478beb7b95f7be9d35f8
Author: Ryan McCabe <rmccabe at redhat.com>
AuthorDate: Fri Jul 12 15:36:35 2013 -0400
Committer: Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Mon Jul 22 12:58:42 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#968322
Signed-off-by: Ryan McCabe <rmccabe at 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 26191b5..02b5bce 100644
--- a/rgmanager/src/clulib/vft.c
+++ b/rgmanager/src/clulib/vft.c
@@ -1034,7 +1034,6 @@ vf_key_init_nt(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;
}
@@ -1042,7 +1041,6 @@ vf_key_init_nt(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;
}
@@ -1519,6 +1517,8 @@ vf_read(cluster_member_list_t *membership, char *keyid, uint64_t *view,
pthread_mutex_unlock(&vf_mutex);
return l;
}
+
+ pthread_mutex_lock(&key_list_mutex);
}
*data = malloc(key_node->kn_datalen);
diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c
index fe532d7..0ae6ea8 100644
--- a/rgmanager/src/daemons/rg_event.c
+++ b/rgmanager/src/daemons/rg_event.c
@@ -371,9 +371,8 @@ event_master(void)
//clulog(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,
More information about the cluster-commits
mailing list