Skip to contentSkip to conversation

cluster/rgmanager src/daemons/groups.c src/dae ...

Cluster-devel [email protected] 1 participant 1 message Dec 18, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL50
Changes by: lhh at sourceware.org 2006-12-18 21:46:58

Modified files:
rgmanager/src/daemons: groups.c rg_locks.c rgmanager/include: rg_locks.h

Log message:
Implement cap on max # of outstanding status check threads; fixes bugzilla #218697

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/groups.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.25&r2=1.25.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_locks.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.7&r2=1.7.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/include/rg_locks.h.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.2&r2=1.2.4.1

rgmanager/src/daemons/groups.c +18 -1
@@ -1,5 +1,5 @@
 /*
-  Copyright Red Hat, Inc. 2002-2003
+  Copyright Red Hat, Inc. 2002-2006
   Copyright Mission Critical Linux, Inc. 2000
 
   This program is free software; you can redistribute it and/or modify it
@@ -849,6 +849,15 @@
 
 	free(arg);
 
+	/* See if we have a slot... */
+	if (rg_inc_status() < 0) {
+		/* Too many outstanding status checks.  try again later. */
+		msg_send_simple(ctx, RG_FAIL, RG_EAGAIN, 0);
+		msg_close(ctx);
+		msg_free_ctx(ctx);
+		return NULL;
+	}
+	
 	pthread_rwlock_rdlock(&resource_lock);
 
 	list_do(&_tree, node) {
@@ -866,6 +875,8 @@
 	msg_receive(ctx, &hdr, sizeof(hdr), 10);
 	msg_close(ctx);
 	msg_free_ctx(ctx);
+	
+	rg_dec_status();
 
 	return NULL;
 }
@@ -1245,6 +1256,12 @@
 		pthread_mutex_unlock(&config_mutex);
 		free(val);
 	}
+	
+	if (ccs_get(fd, "/cluster/rm/@statusmax", &val) == 0) {
+		if (strlen(val)) 
+			rg_set_statusmax(atoi(val));
+		free(val);
+	}
 
 	clulog(LOG_DEBUG, "Building Resource Trees\n");
 	/* About to update the entire resource tree... */
rgmanager/src/daemons/rg_locks.c +45 -0

57 lines not on this page · raw message

rgmanager/include/rg_locks.h +4 -0
@@ -20,6 +20,10 @@
 int rg_set_uninitialized(void);
 int rg_wait_initialized(void);
 
+int rg_inc_status(void);
+int rg_dec_status(void);
+int rg_set_statusmax(int max);
+
 int ccs_lock(void);
 int ccs_unlock(int fd);