Skip to contentSkip to conversation

cluster/gfs2/mount util.c

Cluster-devel [email protected] 1 participant 1 message Jul 19, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: teigland at sourceware.org 2007-07-19 20:22:09

Modified files:
gfs2/mount : util.c

Log message:
more helpful error reporting (sync with HEAD)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/mount/util.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.6&r2=1.18.2.7

gfs2/mount/util.c +11 -12
@@ -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) {