cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] cluster/fence/fenced main.c
@ 2006-11-30 23:56 lhh
  0 siblings, 0 replies; 10+ messages in thread
From: lhh @ 2006-11-30 23:56 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh at sourceware.org	2006-11-30 23:56:03

Modified files:
	fence/fenced   : main.c 

Log message:
	Fix bug where fence agents were getting info up to groupd

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&r1=1.38&r2=1.39

--- cluster/fence/fenced/main.c	2006/10/13 16:03:47	1.38
+++ cluster/fence/fenced/main.c	2006/11/30 23:56:03	1.39
@@ -583,19 +583,13 @@
 	client_init();
 
 	if (!daemon_debug_opt) {
-		pid_t pid = fork();
-		if (pid < 0) {
+		if (daemon(0,0) < 0) {
 			perror("main: cannot fork");
 			exit(EXIT_FAILURE);
 		}
-		if (pid)
-			exit(EXIT_SUCCESS);
-		setsid();
+		
 		chdir("/");
 		umask(0);
-		close(0);
-		close(1);
-		close(2);
 		openlog("fenced", LOG_PID, LOG_DAEMON);
 	}
 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Cluster-devel] cluster/fence/fenced main.c
@ 2006-11-30 23:57 lhh
  0 siblings, 0 replies; 10+ messages in thread
From: lhh @ 2006-11-30 23:57 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	lhh at sourceware.org	2006-11-30 23:57:29

Modified files:
	fence/fenced   : main.c 

Log message:
	Fix bug where fence agents were getting info up to groupd

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.38&r2=1.38.2.1

--- cluster/fence/fenced/main.c	2006/10/13 16:03:47	1.38
+++ cluster/fence/fenced/main.c	2006/11/30 23:57:29	1.38.2.1
@@ -583,19 +583,13 @@
 	client_init();
 
 	if (!daemon_debug_opt) {
-		pid_t pid = fork();
-		if (pid < 0) {
+		if (daemon(0,0) < 0) {
 			perror("main: cannot fork");
 			exit(EXIT_FAILURE);
 		}
-		if (pid)
-			exit(EXIT_SUCCESS);
-		setsid();
+		
 		chdir("/");
 		umask(0);
-		close(0);
-		close(1);
-		close(2);
 		openlog("fenced", LOG_PID, LOG_DAEMON);
 	}
 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Cluster-devel] cluster/fence/fenced main.c
@ 2006-11-30 23:58 lhh
  0 siblings, 0 replies; 10+ messages in thread
From: lhh @ 2006-11-30 23:58 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL50
Changes by:	lhh at sourceware.org	2006-11-30 23:58:05

Modified files:
	fence/fenced   : main.c 

Log message:
	Fix bug where fence agents were getting info up to groupd

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.38&r2=1.38.4.1

--- cluster/fence/fenced/main.c	2006/10/13 16:03:47	1.38
+++ cluster/fence/fenced/main.c	2006/11/30 23:58:05	1.38.4.1
@@ -583,19 +583,13 @@
 	client_init();
 
 	if (!daemon_debug_opt) {
-		pid_t pid = fork();
-		if (pid < 0) {
+		if (daemon(0,0) < 0) {
 			perror("main: cannot fork");
 			exit(EXIT_FAILURE);
 		}
-		if (pid)
-			exit(EXIT_SUCCESS);
-		setsid();
+		
 		chdir("/");
 		umask(0);
-		close(0);
-		close(1);
-		close(2);
 		openlog("fenced", LOG_PID, LOG_DAEMON);
 	}
 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Cluster-devel] cluster/fence/fenced main.c
@ 2006-12-01 15:27 teigland
  0 siblings, 0 replies; 10+ messages in thread
From: teigland @ 2006-12-01 15:27 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	teigland at sourceware.org	2006-12-01 15:27:51

Modified files:
	fence/fenced   : main.c 

Log message:
	group_tool dump doesn't handle partial reads/writes,
	now we always dump entire fixed size debug buffer
	bz 214540

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.38.2.1&r2=1.38.2.2

--- cluster/fence/fenced/main.c	2006/11/30 23:57:29	1.38.2.1
+++ cluster/fence/fenced/main.c	2006/12/01 15:27:50	1.38.2.2
@@ -33,6 +33,43 @@
 commandline_t comline;
 struct list_head domains;
 
+static int do_write(int fd, void *buf, size_t count)
+{
+	int rv, off = 0;
+
+ retry:
+	rv = write(fd, buf + off, count);
+	if (rv == -1 && errno == EINTR)
+		goto retry;
+	if (rv < 0)
+		return rv;
+
+	if (rv != count) {
+		count -= rv;
+		off += rv;
+		goto retry;
+	}
+	return 0;
+}
+
+/*
+static int do_read(int fd, void *buf, size_t count)
+{
+	int rv, off = 0;
+
+	while (off < count) {
+		rv = read(fd, buf + off, count - off);
+		if (rv == 0)
+			return -1;
+		if (rv == -1 && errno == EINTR)
+			continue;
+		if (rv == -1)
+			return -1;
+		off += rv;
+	}
+	return 0;
+}
+*/
 
 static int setup_ccs(fd_t *fd)
 {
@@ -286,18 +323,18 @@
 
 static int do_dump(int ci)
 {
-	int rv, len;
+	int rv, len = DUMP_SIZE;
 
 	if (dump_wrap) {
 		len = DUMP_SIZE - dump_point;
-		rv = write(client[ci].fd, dump_buf + dump_point, len);
-		if (rv != len)
+		rv = do_write(client[ci].fd, dump_buf + dump_point, len);
+		if (rv < 0)
 			log_debug("write error %d errno %d", rv, errno);
+		len = dump_point;
 	}
-	len = dump_point;
 
-	rv = write(client[ci].fd, dump_buf, len);
-	if (rv != len)
+	rv = do_write(client[ci].fd, dump_buf, len);
+	if (rv < 0)
 		log_debug("write error %d errno %d", rv, errno);
 	return 0;
 }



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Cluster-devel] cluster/fence/fenced main.c
@ 2006-12-01 15:27 teigland
  0 siblings, 0 replies; 10+ messages in thread
From: teigland @ 2006-12-01 15:27 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL50
Changes by:	teigland at sourceware.org	2006-12-01 15:27:57

Modified files:
	fence/fenced   : main.c 

Log message:
	group_tool dump doesn't handle partial reads/writes,
	now we always dump entire fixed size debug buffer
	bz 214540

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&only_with_tag=RHEL50&r1=1.38.4.1&r2=1.38.4.2

--- cluster/fence/fenced/main.c	2006/11/30 23:58:05	1.38.4.1
+++ cluster/fence/fenced/main.c	2006/12/01 15:27:57	1.38.4.2
@@ -33,6 +33,43 @@
 commandline_t comline;
 struct list_head domains;
 
+static int do_write(int fd, void *buf, size_t count)
+{
+	int rv, off = 0;
+
+ retry:
+	rv = write(fd, buf + off, count);
+	if (rv == -1 && errno == EINTR)
+		goto retry;
+	if (rv < 0)
+		return rv;
+
+	if (rv != count) {
+		count -= rv;
+		off += rv;
+		goto retry;
+	}
+	return 0;
+}
+
+/*
+static int do_read(int fd, void *buf, size_t count)
+{
+	int rv, off = 0;
+
+	while (off < count) {
+		rv = read(fd, buf + off, count - off);
+		if (rv == 0)
+			return -1;
+		if (rv == -1 && errno == EINTR)
+			continue;
+		if (rv == -1)
+			return -1;
+		off += rv;
+	}
+	return 0;
+}
+*/
 
 static int setup_ccs(fd_t *fd)
 {
@@ -286,18 +323,18 @@
 
 static int do_dump(int ci)
 {
-	int rv, len;
+	int rv, len = DUMP_SIZE;
 
 	if (dump_wrap) {
 		len = DUMP_SIZE - dump_point;
-		rv = write(client[ci].fd, dump_buf + dump_point, len);
-		if (rv != len)
+		rv = do_write(client[ci].fd, dump_buf + dump_point, len);
+		if (rv < 0)
 			log_debug("write error %d errno %d", rv, errno);
+		len = dump_point;
 	}
-	len = dump_point;
 
-	rv = write(client[ci].fd, dump_buf, len);
-	if (rv != len)
+	rv = do_write(client[ci].fd, dump_buf, len);
+	if (rv < 0)
 		log_debug("write error %d errno %d", rv, errno);
 	return 0;
 }



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Cluster-devel] cluster/fence/fenced main.c
@ 2006-12-01 15:28 teigland
  0 siblings, 0 replies; 10+ messages in thread
From: teigland @ 2006-12-01 15:28 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland at sourceware.org	2006-12-01 15:28:12

Modified files:
	fence/fenced   : main.c 

Log message:
	group_tool dump doesn't handle partial reads/writes,
	now we always dump entire fixed size debug buffer
	bz 214540

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&r1=1.39&r2=1.40

--- cluster/fence/fenced/main.c	2006/11/30 23:56:03	1.39
+++ cluster/fence/fenced/main.c	2006/12/01 15:28:11	1.40
@@ -33,6 +33,43 @@
 commandline_t comline;
 struct list_head domains;
 
+static int do_write(int fd, void *buf, size_t count)
+{
+	int rv, off = 0;
+
+ retry:
+	rv = write(fd, buf + off, count);
+	if (rv == -1 && errno == EINTR)
+		goto retry;
+	if (rv < 0)
+		return rv;
+
+	if (rv != count) {
+		count -= rv;
+		off += rv;
+		goto retry;
+	}
+	return 0;
+}
+
+/*
+static int do_read(int fd, void *buf, size_t count)
+{
+	int rv, off = 0;
+
+	while (off < count) {
+		rv = read(fd, buf + off, count - off);
+		if (rv == 0)
+			return -1;
+		if (rv == -1 && errno == EINTR)
+			continue;
+		if (rv == -1)
+			return -1;
+		off += rv;
+	}
+	return 0;
+}
+*/
 
 static int setup_ccs(fd_t *fd)
 {
@@ -286,18 +323,18 @@
 
 static int do_dump(int ci)
 {
-	int rv, len;
+	int rv, len = DUMP_SIZE;
 
 	if (dump_wrap) {
 		len = DUMP_SIZE - dump_point;
-		rv = write(client[ci].fd, dump_buf + dump_point, len);
-		if (rv != len)
+		rv = do_write(client[ci].fd, dump_buf + dump_point, len);
+		if (rv < 0)
 			log_debug("write error %d errno %d", rv, errno);
+		len = dump_point;
 	}
-	len = dump_point;
 
-	rv = write(client[ci].fd, dump_buf, len);
-	if (rv != len)
+	rv = do_write(client[ci].fd, dump_buf, len);
+	if (rv < 0)
 		log_debug("write error %d errno %d", rv, errno);
 	return 0;
 }



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Cluster-devel] cluster/fence/fenced main.c
@ 2007-08-15 20:55 teigland
  0 siblings, 0 replies; 10+ messages in thread
From: teigland @ 2007-08-15 20:55 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland at sourceware.org	2007-08-15 20:55:02

Modified files:
	fence/fenced   : main.c 

Log message:
	clean out junk that was only relevant to rhel4

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&r1=1.41&r2=1.42

--- cluster/fence/fenced/main.c	2007/01/22 23:15:54	1.41
+++ cluster/fence/fenced/main.c	2007/08/15 20:55:02	1.42
@@ -15,7 +15,7 @@
 #include "ccs.h"
 #include "copyright.cf"
 
-#define OPTION_STRING			("cj:f:Dn:O:hVSw")
+#define OPTION_STRING			("cj:f:Dn:O:hVS")
 #define LOCKFILE_NAME			"/var/run/fenced.pid"
 
 struct client {
@@ -613,11 +613,6 @@
 			exit(EXIT_SUCCESS);
 			break;
 
-		case 'w':
-			/* do nothing, this is a fence_tool option that
-			   we ignore when fence_tool starts us */
-			break;
-
 		case ':':
 		case '?':
 			fprintf(stderr, "Please use '-h' for usage.\n");



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Cluster-devel] cluster/fence/fenced main.c
@ 2007-10-01 16:30 rmccabe
  0 siblings, 0 replies; 10+ messages in thread
From: rmccabe @ 2007-10-01 16:30 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rmccabe at sourceware.org	2007-10-01 16:30:57

Modified files:
	fence/fenced   : main.c 

Log message:
	Fix 314091

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&r1=1.43&r2=1.44

--- cluster/fence/fenced/main.c	2007/08/22 08:58:42	1.43
+++ cluster/fence/fenced/main.c	2007/10/01 16:30:57	1.44
@@ -459,8 +459,11 @@
 
 	for (;;) {
 		rv = poll(pollfd, maxi + 1, -1);
-		if (rv < 0)
+		if (rv < 0) {
+			if (errno == EINTR)
+				continue;
 			break;
+		}
 
 		/* client[0] is listening for new connections */
 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Cluster-devel] cluster/fence/fenced main.c
@ 2007-10-01 16:32 rmccabe
  0 siblings, 0 replies; 10+ messages in thread
From: rmccabe @ 2007-10-01 16:32 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-10-01 16:32:26

Modified files:
	fence/fenced   : main.c 

Log message:
	Fix 314091

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.38.2.3&r2=1.38.2.4

--- cluster/fence/fenced/main.c	2007/01/29 20:30:25	1.38.2.3
+++ cluster/fence/fenced/main.c	2007/10/01 16:32:26	1.38.2.4
@@ -459,8 +459,11 @@
 
 	for (;;) {
 		rv = poll(pollfd, maxi + 1, -1);
-		if (rv < 0)
+		if (rv < 0) {
+			if (errno == EINTR)
+				continue;
 			break;
+		}
 
 		/* client[0] is listening for new connections */
 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Cluster-devel] cluster/fence/fenced main.c
@ 2007-10-26 19:33 teigland
  0 siblings, 0 replies; 10+ messages in thread
From: teigland @ 2007-10-26 19:33 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland at sourceware.org	2007-10-26 19:33:47

Modified files:
	fence/fenced   : main.c 

Log message:
	Improve the dumping of debug logs from daemons.
	bz 317181
	
	group_tool reads debug logs from groupd, fenced, and gfs_controld.
	The dumping code in all three daemons is now identical.  The other
	change is that the dumping function terminates the final write
	with \0, and no longer sends the entire 1MB log buffer if it's not full.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&r1=1.44&r2=1.45

--- cluster/fence/fenced/main.c	2007/10/01 16:30:57	1.44
+++ cluster/fence/fenced/main.c	2007/10/26 19:33:47	1.45
@@ -338,21 +338,22 @@
 		client[i].fd = -1;
 }
 
-static int do_dump(int ci)
+static int do_dump(int fd)
 {
-	int rv, len = DUMP_SIZE;
+	int len;
 
 	if (dump_wrap) {
 		len = DUMP_SIZE - dump_point;
-		rv = do_write(client[ci].fd, dump_buf + dump_point, len);
-		if (rv < 0)
-			log_debug("write error %d errno %d", rv, errno);
+		do_write(fd, dump_buf + dump_point, len);
+		len = dump_point;
+	} else
 		len = dump_point;
-	}
 
-	rv = do_write(client[ci].fd, dump_buf, len);
-	if (rv < 0)
-		log_debug("write error %d errno %d", rv, errno);
+	/* NUL terminate the debug string */
+	dump_buf[dump_point] = '\0';
+
+	do_write(fd, dump_buf, len);
+
 	return 0;
 }
 
@@ -386,7 +387,8 @@
 	else if (!strcmp(cmd, "leave"))
 		rv = do_leave(name);
 	else if (!strcmp(cmd, "dump")) {
-		do_dump(ci);
+		do_dump(client[ci].fd);
+		close(client[ci].fd);
 		return 0;
 	} else
 		rv = -EINVAL;



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-10-26 19:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-01 16:30 [Cluster-devel] cluster/fence/fenced main.c rmccabe
  -- strict thread matches above, loose matches on Subject: below --
2007-10-26 19:33 teigland
2007-10-01 16:32 rmccabe
2007-08-15 20:55 teigland
2006-12-01 15:28 teigland
2006-12-01 15:27 teigland
2006-12-01 15:27 teigland
2006-11-30 23:58 lhh
2006-11-30 23:57 lhh
2006-11-30 23:56 lhh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).