From mboxrd@z Thu Jan 1 00:00:00 1970 From: lhh@sourceware.org Date: 7 Sep 2006 18:41:24 -0000 Subject: [Cluster-devel] cluster/magma-plugins/sm sm.c Message-ID: <20060907184124.29237.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Branch: RHEL4 Changes by: lhh at 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 #include #include +#include -#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));