Skip to contentSkip to conversation

cluster/rgmanager/src/daemons groups.c

Cluster-devel [email protected] 1 participant 1 message Feb 21, 2007

lore
Share & tools
lore
#0 lore raw

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

rgmanager/src/daemons/groups.c +6 -0
@@ -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;
 }