[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/magma-plugins/sm sm.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh sourceware org	2006-09-07 18:41:24

Modified files:
	magma-plugins/sm: sm.c 

Log message:
	Fix 146924 - segfault if cman does not give out a membership list.
	NOTE: Only for RHEL4 branch; depends on udev.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/magma-plugins/sm/sm.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.9&r2=1.9.2.10

--- cluster/magma-plugins/sm/Attic/sm.c	2006/06/16 19:54:57	1.9.2.9
+++ cluster/magma-plugins/sm/Attic/sm.c	2006/09/07 18:41:23	1.9.2.10
@@ -34,8 +34,9 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/select.h>
+#include <sys/stat.h>
 
-#define MODULE_DESCRIPTION "CMAN/SM Plugin v1.1.7.1"
+#define MODULE_DESCRIPTION "CMAN/SM Plugin v1.1.7.2"
 #define MODULE_AUTHOR      "Lon Hohberger"
 
 #define DLM_LS_NAME	   "Magma"
@@ -368,17 +369,23 @@
 sm_open(cluster_plugin_t *self)
 {
 	sm_priv_t *p;
+	struct stat st;
 
 	assert(self);
 	p = (sm_priv_t *)self->cp_private.p_data;
 	assert(p);
 
+	/* Check for existince of dlm control file so we don't
+	   hang in dlm_acquire_lockspace */
+	if (stat("/dev/dlm-control", &st) < 0)
+		return -1;
+
 	if (p->sockfd >= 0)
 		close(p->sockfd);
 
 	p->sockfd = socket(AF_CLUSTER, SOCK_DGRAM, CLPROTO_CLIENT);
 	if (p->sockfd < 0)
-		return -errno;
+		return -1;
 
 	return p->sockfd;
 }
@@ -601,7 +608,7 @@
                 /* Work around race: Someone was closing lockspace as
                    we were trying to open it.  Retry. */
                 if (errno == ENOENT)
-                        continue;
+			continue;
 
                 fprintf(stderr, "failed acquiring lockspace: %s\n",
                         strerror(errno));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]