[Cluster-devel] cluster/rgmanager/src/daemons groups.c

lhh at sourceware.org lhh at sourceware.org
Wed Feb 21 20:46:50 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	lhh at sourceware.org	2007-02-21 20:46:50

Modified files:
	rgmanager/src/daemons: groups.c 

Log message:
	Resolves: 222445
	* Only allow one status check thread to spawn at a time

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.25.2.1&r2=1.25.2.2

--- cluster/rgmanager/src/daemons/groups.c	2006/12/18 21:48:48	1.25.2.1
+++ cluster/rgmanager/src/daemons/groups.c	2007/02/21 20:46:49	1.25.2.2
@@ -44,6 +44,7 @@
 static fod_t *_domains = NULL;
 
 pthread_mutex_t config_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t status_mutex = PTHREAD_MUTEX_INITIALIZER;
 pthread_rwlock_t resource_lock = PTHREAD_RWLOCK_INITIALIZER;
 
 void res_build_name(char *, size_t, resource_t *);
@@ -991,6 +992,10 @@
 	resource_node_t *curr;
 	rg_state_t svcblk;
 	char rg[64];
+	
+	/* Only one status thread at a time, please! */
+	if (pthread_mutex_trylock(&status_mutex) != 0)
+		return NULL;
 
 	pthread_rwlock_rdlock(&resource_lock);
 	list_do(&_tree, curr) {
@@ -1013,6 +1018,7 @@
 	} while (!list_done(&_tree, curr));
 
 	pthread_rwlock_unlock(&resource_lock);
+	pthread_mutex_unlock(&status_mutex);
 
 	return NULL;
 }




More information about the Cluster-devel mailing list