cluster: STABLE32 - rgmanager: Clean up lock handling in groups.c

Ryan McCabe rmccabe at fedoraproject.org
Wed May 2 17:06:01 UTC 2012


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=7ec6da281db5c9ad521147c4ed5203d3bb1101dc
Commit:        7ec6da281db5c9ad521147c4ed5203d3bb1101dc
Parent:        23cbaf1816760187fef869da88cad417a4e5f535
Author:        Ryan McCabe <rmccabe at redhat.com>
AuthorDate:    Wed May 2 12:51:06 2012 -0400
Committer:     Ryan McCabe <rmccabe at redhat.com>
CommitterDate: Wed May 2 12:51:06 2012 -0400

rgmanager: Clean up lock handling in groups.c

Fix two error paths where we returned without releasing locks we have
taken.

Signed-off-by: Ryan McCabe <rmccabe at redhat.com>
---
 rgmanager/src/daemons/groups.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c
index ff80caa..4a72cb7 100644
--- a/rgmanager/src/daemons/groups.c
+++ b/rgmanager/src/daemons/groups.c
@@ -399,12 +399,14 @@ check_depend_safe(const char *rg_name)
 
 	pthread_rwlock_rdlock(&resource_lock);
 	res = find_root_by_ref(&_resources, rg_name);
-	if (!res)
-		return -1;
+	if (!res) {
+		ret = -1;
+		goto out_unlock;
+	}
 
 	ret = check_depend(res);
+out_unlock:
 	pthread_rwlock_unlock(&resource_lock);
-
 	return ret;
 }
 
@@ -933,7 +935,7 @@ group_migratory(const char *groupname, int lock)
 	res = find_root_by_ref(&_resources, groupname);
 	if (!res) {
 		/* Nonexistent or non-TL RG cannot be migrated */
-		return 0;
+		goto out_unlock;
 	}
 
 	for (x = 0; res->r_rule->rr_actions[x].ra_name; x++) {


More information about the cluster-commits mailing list