Skip to contentSkip to conversation

cluster fence/fenced/group.c fence/fenced/main ...

Cluster-devel [email protected] 1 participant 1 message Oct 13, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2006-10-13 16:03:48

Modified files:
fence/fenced : group.c main.c
gnbd/utils : group.c
group/dlm_controld: group.c
group/gfs_controld: group.c
group/lib : libgroup.c libgroup.h

Log message:
This fix is for bugzilla 210641: Race condition hang/failure between cman daemons and groupd. Added a retry with timeout to group_init and all its callers.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/group.c.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gnbd/utils/group.c.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/group.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/group.c.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/lib/libgroup.c.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/lib/libgroup.h.diff?cvsroot=cluster&r1=1.16&r2=1.17

fence/fenced/group.c +4 -5
@@ -18,6 +18,8 @@
 #define DO_TERMINATE 4
 #define DO_SETID 5
 
+#define GROUPD_TIMEOUT 10 /* seconds */
+
 /* save all the params from callback functions here because we can't
    do the processing within the callback function itself */
 
@@ -157,17 +159,14 @@
 {
 	int rv;
 
-	gh = group_init(NULL, "fence", 0, &callbacks);
+	gh = group_init(NULL, "fence", 0, &callbacks, GROUPD_TIMEOUT);
 	if (!gh) {
 		log_error("group_init error %d %d", (int) gh, errno);
 		return -ENOTCONN;
 	}
-
 	rv = group_get_fd(gh);
-	if (rv < 0) {
+	if (rv < 0)
 		log_error("group_get_fd error %d %d", rv, errno);
-	}
-
 	return rv;
 }
 
fence/fenced/main.c +2 -1
@@ -182,7 +182,7 @@
 
 	fd = find_domain(name);
 	if (fd) {
-		log_debug("join error: domain exists");
+		log_debug("join error: domain %s exists", name);
 		rv = -EEXIST;
 		goto out;
 	}
@@ -204,6 +204,7 @@
 	rv = group_join(gh, name);
 	if (rv) {
 		log_error("group_join error %d", rv);
+		list_del(&fd->list);
 		free(fd);
 	}
  out:
gnbd/utils/group.c +2 -1
@@ -21,6 +21,7 @@
 #include "group.h"
 
 #define MAXLINE 256
+#define GROUPD_TIMEOUT 10
 
 /* save all the params from callback functions here because we can't
    do the processing within the callback function itself */
@@ -139,7 +140,7 @@
 {
 	int rv;
 
-	gh = group_init(NULL, name, 0, &callbacks);
+	gh = group_init(NULL, name, 0, &callbacks, GROUPD_TIMEOUT);
 	if (!gh) {
 		log_err("group_init error %d %d", (int) gh, errno);
 		return -ENOTCONN;
group/dlm_controld/group.c +3 -1
@@ -18,6 +18,8 @@
 #define DO_TERMINATE 4
 #define DO_SETID 5
 
+#define GROUPD_TIMEOUT 10 /* seconds */
+
 /* save all the params from callback functions here because we can't
    do the processing within the callback function itself */
 
@@ -199,7 +201,7 @@
 {
 	int rv;
 
-	gh = group_init(NULL, "dlm", 1, &callbacks);
+	gh = group_init(NULL, "dlm", 1, &callbacks, GROUPD_TIMEOUT);
 	if (!gh) {
 		log_error("group_init error %d %d", (int) gh, errno);
 		return -ENOTCONN;
group/gfs_controld/group.c +3 -1
@@ -15,6 +15,8 @@
 /* save all the params from callback functions here because we can't
    do the processing within the callback function itself */
 
+#define GROUPD_TIMEOUT 10 /* seconds */
+
 group_handle_t gh;
 static int cb_action;
 static char cb_name[MAX_GROUP_NAME_LEN+1];
@@ -168,7 +170,7 @@
 	int rv;
 
 	gh = group_init(NULL, LOCK_DLM_GROUP_NAME, LOCK_DLM_GROUP_LEVEL,
-			&callbacks);
+					&callbacks, GROUPD_TIMEOUT);
 	if (!gh) {
 		log_error("group_init error %d %d", (int) gh, errno);
 		return -ENOTCONN;
group/lib/libgroup.c +40 -36

102 lines not on this page · raw message

group/lib/libgroup.h +2 -2
@@ -54,7 +54,7 @@
 	group_deliver_t deliver;
 } group_callbacks_t;
 
-group_handle_t group_init(void *private, char *prog_name, int level, group_callbacks_t *cbs);
+group_handle_t group_init(void *private, char *prog_name, int level, group_callbacks_t *cbs, int timeout);
 int group_exit(group_handle_t handle);
 
 int group_join(group_handle_t handle, char *name);
@@ -88,7 +88,7 @@
    don't interfere with dispatchable callback messages. */
 
 int group_get_groups(int max, int *count, group_data_t *data);
-int group_get_group(int level, char *name, group_data_t *data);
+int group_get_group(int level, const char *name, group_data_t *data);
 
 #endif