[Cluster-devel] cluster/gfs2/mount util.c

teigland at sourceware.org teigland at sourceware.org
Thu Jun 28 17:58:31 UTC 2007


CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland at sourceware.org	2007-06-28 17:58:31

Modified files:
	gfs2/mount     : util.c 

Log message:
	- add more specific warnings/errors when connecting to gfs_controld fails
	- use strerror to report more helpful error messages in a few spots

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/util.c.diff?cvsroot=cluster&r1=1.24&r2=1.25

--- cluster/gfs2/mount/util.c	2007/06/06 15:45:11	1.24
+++ cluster/gfs2/mount/util.c	2007/06/28 17:58:31	1.25
@@ -327,8 +327,11 @@
 	int rv, fd;
 
 	fd = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (fd < 0)
+	if (fd < 0) {
+		warn("can't create socket for gfs_controld connection: %s",
+		     strerror(errno));
 		goto out;
+	}
 
 	memset(&sun, 0, sizeof(sun));
 	sun.sun_family = AF_UNIX;
@@ -337,6 +340,7 @@
 
 	rv = connect(fd, (struct sockaddr *) &sun, addrlen);
 	if (rv < 0) {
+		warn("can't connect to gfs_controld: %s", strerror(errno));
 		close(fd);
 		fd = rv;
 	}
@@ -406,10 +410,8 @@
 	i = 0;
 	do {
 		fd = gfs_controld_connect();
-		if (fd <= 0) {
-			warn("waiting for gfs_controld to start");
+		if (fd <= 0)
 			sleep(1);
-		}
 	} while (fd <= 0 && ++i < 10);
 
 	/* FIXME: should we start the daemon here? */
@@ -447,7 +449,7 @@
 
 	rv = write(fd, buf, sizeof(buf));
 	if (rv < 0) {
-		warn("gfs_controld write error: %d", rv);
+		warn("gfs_controld write error: %s", strerror(errno));
 		goto out;
 	}
 
@@ -463,7 +465,8 @@
 	memset(buf, 0, sizeof(buf));
 	rv = read(fd, buf, sizeof(buf));
 	if (rv < 0) {
-		warn("error reading result from gfs_controld: %d", rv);
+		warn("error reading result from gfs_controld: %s",
+		     strerror(errno));
 		goto out;
 	}
 	rv = atoi(buf);
@@ -637,10 +640,8 @@
 	i = 0;
 	do {
 		fd = gfs_controld_connect();
-		if (fd <= 0) {
-			warn("waiting for gfs_controld to start");
+		if (fd <= 0)
 			sleep(1);
-		}
 	} while (fd <= 0 && ++i < 10);
 
 	if (fd <= 0) {
@@ -717,10 +718,8 @@
 	i = 0;
 	do {
 		fd = gfs_controld_connect();
-		if (fd <= 0) {
-			warn("waiting for gfs_controld to start");
+		if (fd <= 0)
 			sleep(1);
-		}
 	} while (fd <= 0 && ++i < 10);
 
 	if (fd <= 0) {




More information about the Cluster-devel mailing list