Skip to contentSkip to conversation

cluster/group daemon/main.c gfs_controld/main.c

Cluster-devel [email protected] 1 participant 1 message Aug 31, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2006-08-31 18:17:32

Modified files:
group/daemon : main.c
group/gfs_controld: main.c

Log message:
This is a fix for Bugzilla Bug 203916: groupd daemon segfault and mount hang when mounting five or more GFS file systems.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/main.c.diff?cvsroot=cluster&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&r1=1.10&r2=1.11

group/daemon/main.c +12 -4
@@ -25,8 +25,8 @@
 int			cman_quorate;
 
 static int client_maxi;
-static int client_size;
-static struct client *client;
+static int client_size = 0;
+static struct client *client = NULL;
 static struct pollfd *pollfd;
 static char last_action[16];
 
@@ -334,17 +334,25 @@
 
 	if (!client)
 		client = malloc(NALLOC * sizeof(struct client));
-	else
+	else {
 		client = realloc(client, (client_size + NALLOC) *
 				         sizeof(struct client));
+		pollfd = realloc(pollfd, (client_size + NALLOC) *
+						 sizeof(struct pollfd));
+		if (!pollfd)
+			log_print("can't alloc for pollfd");
+	}
 	if (!client)
 		log_print("can't alloc for client array");
 
 	for (i = client_size; i < client_size + NALLOC; i++) {
 		client[i].workfn = NULL;
+		client[i].deadfn = NULL;
 		client[i].fd = -1;
 		client[i].level = -1;
 		memset(client[i].type, 0, sizeof(client[i].type));
+		pollfd[i].fd = -1;
+		pollfd[i].revents = 0;
 	}
 	client_size += NALLOC;
 }
@@ -844,7 +852,7 @@
 	if (!groupd_debug_opt)
 		daemonize();
 
-	pollfd = malloc(MAXCON * sizeof(struct pollfd));
+	pollfd = malloc(NALLOC * sizeof(struct pollfd));
 	if (!pollfd)
 		return -1;
 
group/gfs_controld/main.c +31 -14

59 lines not on this page · raw message