gfs2-utils: master - gfs2-utils: gfs2_grow fails to grow a filesystem with less than 3 RGs
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: e2e273467a776ef257e1d7e284088ae9e7cbec43
Parent: 6d523768ac2689a8f860b73fdd822ed212f4bbc7
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Fri Sep 30 10:02:34 2011 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Sep 30 10:02:34 2011 -0500
gfs2-utils: gfs2_grow fails to grow a filesystem with less than 3 RGs
This patch fixes a problem with gfs2-utils whereby some of the utils
couldn't handle a small file system with one or two rgrps.
The biggest offender was gfs2_grow: you couldn't successfully
gfs2_grow a file system that was so small that it had only one
resource group. Also, "gfs2_edit savemeta" couldn't save it.
This patch fixes the problem by creating a generic rgrp_size function
in libgfs2 that calculates the size rather than judging its
distance from the previous rgrp.
rhbz#730091
---
gfs2/edit/savemeta.c | 6 ++----
gfs2/libgfs2/fs_geometry.c | 6 +++---
gfs2/libgfs2/libgfs2.h | 5 +++++
gfs2/libgfs2/super.c | 4 ++--
gfs2/mkfs/main_grow.c | 27 +++++++++------------------
5 files changed, 21 insertions(+), 27 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 9e5d111..31af23d 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -637,7 +637,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
int rgcount;
uint64_t jindex_block;
struct gfs2_buffer_head *lbh;
- struct rgrp_tree *last_rgd, *prev_rgd;
+ struct rgrp_tree *last_rgd;
struct metafd mfd;
slow = (saveoption == 1);
@@ -715,9 +715,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
n = osi_last(&sbd.rgtree);
last_rgd = (struct rgrp_tree *)n;
n = osi_prev(n);
- prev_rgd = (struct rgrp_tree *)n;
- fssize = last_rgd->ri.ri_addr +
- (last_rgd->ri.ri_addr - prev_rgd->ri.ri_addr);
+ fssize = last_rgd->ri.ri_addr + rgrp_size(last_rgd);
last_fs_block = fssize;
fssize *= sbd.bsize;
printf("Done. File system size: %s\n\n",
diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c
index 2b70f11..130331a 100644
--- a/gfs2/libgfs2/fs_geometry.c
+++ b/gfs2/libgfs2/fs_geometry.c
@@ -80,8 +80,8 @@ void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree,
struct device *dev;
struct rgrp_tree *rl, *rlast = NULL, *rlast2 = NULL;
struct osi_node *n, *next = NULL;
- unsigned int rgrp = 0, nrgrp;
- uint64_t rglength, rgaddr;
+ unsigned int rgrp = 0, nrgrp, rglength;
+ uint64_t rgaddr;
sdp->new_rgrps = 0;
dev = &sdp->device;
@@ -113,7 +113,7 @@ void compute_rgrp_layout(struct gfs2_sbd *sdp, struct osi_root *rgtree,
rlast = rl;
}
rlast->start = rlast->ri.ri_addr;
- rglength = rlast->ri.ri_addr - rlast2->ri.ri_addr;
+ rglength = rgrp_size(rlast);
rlast->length = rglength;
old_length = rlast->ri.ri_addr + rglength;
new_chunk = dev->length - old_length;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 53df6cd..77dfc29 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -708,6 +708,11 @@ extern void gfs2_rgrp_relse(struct rgrp_tree *rgd);
extern struct rgrp_tree *rgrp_insert(struct osi_root *rgtree,
uint64_t rgblock);
extern void gfs2_rgrp_free(struct osi_root *rgrp_tree);
+/* figure out the size of the given resource group, in blocks */
+static inline unsigned int rgrp_size(struct rgrp_tree *rgrp)
+{
+ return rgrp->ri.ri_data + rgrp->ri.ri_length;
+}
/* structures.c */
extern int build_master(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
index c354b07..c844287 100644
--- a/gfs2/libgfs2/super.c
+++ b/gfs2/libgfs2/super.c
@@ -194,7 +194,7 @@ int rindex_read(struct gfs2_sbd *sdp, int fd, int *count1, int *sane)
*sane = 0;
}
prev_length = rgd->start - prev_rgd->start;
- prev_rgd->length = prev_length;
+ prev_rgd->length = rgrp_size(prev_rgd);
}
if(gfs2_compute_bitstructs(sdp, rgd))
@@ -204,7 +204,7 @@ int rindex_read(struct gfs2_sbd *sdp, int fd, int *count1, int *sane)
prev_rgd = rgd;
}
if (prev_rgd)
- prev_rgd->length = prev_length;
+ prev_rgd->length = rgrp_size(prev_rgd);
return 0;
}
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index dc092ee..7a32d7e 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -122,23 +122,6 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
}
/**
- * figure_out_rgsize
- */
-static void figure_out_rgsize(struct gfs2_sbd *sdp, unsigned int *orgsize)
-{
- struct osi_node *n = osi_first(&sdp->rgtree), *next = NULL;
- struct rgrp_tree *r1, *r2;
-
- sdp->rgsize = GFS2_DEFAULT_RGSIZE;
- next = osi_next(n);
- r1 = (struct rgrp_tree *)next;
- next = osi_next(next);
- r2 = (struct rgrp_tree *)next;
-
- *orgsize = r2->ri.ri_addr - r1->ri.ri_addr;
-}
-
-/**
* filesystem_size - Calculate the size of the filesystem
*
* Reads the lists of resource groups in order to
@@ -324,6 +307,7 @@ main_grow(int argc, char *argv[])
while ((argc - optind) > 0) {
int sane;
+ struct rgrp_tree *last_rgrp;
sdp->path_name = argv[optind++];
sdp->path_fd = open(sdp->path_name, O_RDONLY | O_CLOEXEC);
@@ -391,7 +375,13 @@ main_grow(int argc, char *argv[])
/* the existing RGs, and only write to the index at EOF. */
ri_update(sdp, rindex_fd, &rgcount, &sane);
fssize = filesystem_size(sdp);
- figure_out_rgsize(sdp, &rgsize);
+ if (!sdp->rgtree.osi_node) {
+ log_err(_("Error: No resource groups found.\n"));
+ goto out;
+ }
+ last_rgrp = (struct rgrp_tree *)osi_last(&sdp->rgtree);
+ sdp->rgsize = GFS2_DEFAULT_RGSIZE;
+ rgsize = rgrp_size(last_rgrp);
fsgrowth = ((sdp->device.length - fssize) * sdp->bsize);
if (fsgrowth < rgsize * sdp->bsize) {
log_err( _("Error: The device has grown by less than "
@@ -409,6 +399,7 @@ main_grow(int argc, char *argv[])
initialize_new_portion(sdp, &old_rg_count);
fix_rindex(sdp, rindex_fd, old_rg_count);
}
+ out:
/* Delete the remaining RGs from the rglist */
gfs2_rgrp_free(&sdp->rgtree);
close(rindex_fd);
12 years, 7 months
fence-agents: the annotated tag v3.1.6 has been created
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: e4cca2d855efab8322eb046db451e7a4abfefd3e
Parent: 0000000000000000000000000000000000000000
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: 2011-09-30 12:42 +0000
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: 2011-09-30 12:42 +0000
annotated tag: v3.1.6 has been created
at e4cca2d855efab8322eb046db451e7a4abfefd3e (tag)
tagging 8c11e2e4bf971ec75acf6cbc5b81c8efbaa273e3 (commit)
replaces v3.1.5
v3.1.6 release
Fabio M. Di Nitto (2):
build: add extra check required for fence_kdump
build: make sure fence_kdump man pages are in the release tarball
Kristoffer Knigga (1):
ipmilan: Allow privilege selection
Lon Hohberger (2):
Add rha:name and rha:description tag to RelaxNG XSL
fence_kdump: Fix metadata
Marek 'marx' Grac (6):
fence_drac5: drac5 firmware does not close ssh session correctly
fence_rhevm: change "UP" status to "up" state as the REST-API has changed
fence_rhevm: REST API URL needs to be updated to /api
Merge branch 'master' of http://git.fedorahosted.org/git/fence-agents
fence_ipmilan: fence_ipmilan exposes user password on verbose mode
fence_ipmilan: is not parsing args with passwd_script option in cluster.conf
Ryan O'Hara (12):
fence_kdump: New fence agent for use with kdump
Merge branch 'master' of ssh://git.fedorahosted.org/git/fence-agents
Updated to include new fence_kdump agent.
fence_kdump: fix compiler warnings
fence_kdump: include ctype.h
fence_kdump: remove FENCE_KDUMP_MSGV2
fence_kdump: Increase default timeout to 120
fence_kdump: remove binary files from git
fence_kdump: Fix logging
fence_kdump: change default timeout back to 60
fence_kdump: fix potential null dereference
fence_scsi: fix simultaneous unfence operations
12 years, 7 months
dlm: master - dlm_controld: remove ccs and new Makefile
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=591a71f2...
Commit: 591a71f29677257ae49ce6d10a4bd1da19d73233
Parent: e529211682418a8e33feafc9f703cff87e23aeba
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Sep 29 16:53:48 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Sep 29 16:53:48 2011 -0500
dlm_controld: remove ccs and new Makefile
replace libccs on cluster.conf with libxml on dlm.conf
add a normal, sane Makefile
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/dlm_controld/Makefile | 50 +++++
group/dlm_controld/action.c | 3 +-
group/dlm_controld/config.c | 371 ++++++--------------------------------
group/dlm_controld/config.h | 3 -
group/dlm_controld/cpg.c | 1 -
group/dlm_controld/dlm_daemon.h | 30 +++-
group/dlm_controld/logging.c | 14 +--
group/dlm_controld/main.c | 18 +--
group/dlm_controld/member_cman.c | 1 -
group/dlm_controld/plock.c | 2 -
10 files changed, 136 insertions(+), 357 deletions(-)
diff --git a/group/dlm_controld/Makefile b/group/dlm_controld/Makefile
new file mode 100644
index 0000000..63dcb9b
--- /dev/null
+++ b/group/dlm_controld/Makefile
@@ -0,0 +1,50 @@
+TARGET = dlm_controld
+
+SOURCE = \
+ action.c \
+ cpg.c \
+ crc.c \
+ main.c \
+ plock.c \
+ config.c \
+ member_cman.c \
+ logging.c \
+ rbtree.c
+
+CFLAGS += -D_GNU_SOURCE -g \
+ -Wall \
+ -Wformat \
+ -Wformat-security \
+ -Wmissing-prototypes \
+ -Wnested-externs \
+ -Wpointer-arith \
+ -Wextra -Wshadow \
+ -Wcast-align \
+ -Wwrite-strings \
+ -Waggregate-return \
+ -Wstrict-prototypes \
+ -Winline \
+ -Wredundant-decls \
+ -Wno-sign-compare \
+ -Wno-unused-parameter \
+ -Wp,-D_FORTIFY_SOURCE=2 \
+ -fexceptions \
+ -fasynchronous-unwind-tables \
+ -fdiagnostics-show-option \
+
+CFLAGS += -fPIE -DPIE
+CFLAGS += `xml2-config --cflags`
+CFLAGS += -I../include -I../../dlm/libdlm -I../../dlm/libdlmcontrol
+
+LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
+LDFLAGS += `xml2-config --libs`
+LDFLAGS += -lpthread -llogthread -lcpg -lconfdb -lcfg -lquorum -lfenced
+
+all: $(TARGET)
+
+$(TARGET): $(SOURCE)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(SOURCE) -o $@ -L.
+
+clean:
+ rm -f *.o *.so *.so.* $(TARGET)
+
diff --git a/group/dlm_controld/action.c b/group/dlm_controld/action.c
index 0570a2f..e9148a1 100644
--- a/group/dlm_controld/action.c
+++ b/group/dlm_controld/action.c
@@ -1,5 +1,4 @@
#include "dlm_daemon.h"
-#include "config.h"
#include <corosync/corotypes.h>
#include <corosync/confdb.h>
@@ -317,7 +316,7 @@ static int create_path(const char *path)
return rv;
}
-static int path_exists(const char *path)
+int path_exists(const char *path)
{
struct stat buf;
diff --git a/group/dlm_controld/config.c b/group/dlm_controld/config.c
index 5633538..40b0c87 100644
--- a/group/dlm_controld/config.c
+++ b/group/dlm_controld/config.c
@@ -1,346 +1,93 @@
#include "dlm_daemon.h"
+#include <libxml/tree.h>
-#include <sys/types.h>
-#include <asm/types.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <dirent.h>
+/* TODO:
+ <dlm>
+ <lockspace name="foo" nodir="1">
+ <master nodeid="1" weight="2"/>
+ <master nodeid="2" weight="3"/>
+ </lockspace>
+ </dlm>
+*/
-#include "config.h"
-#include "ccs.h"
-
-int ccs_handle;
-
-/* when not set in cluster.conf, a node's default weight is 1 */
-
-#define MASTER_PATH "/cluster/dlm/lockspace[@name=\"%s\"]/master"
-#define WEIGHT_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/@weight"
-#define MASTER_NAME MASTER_PATH "/@name"
-#define MASTER_WEIGHT MASTER_PATH "[@name=\"%s\"]/@weight"
-
-/* look for node's weight in the dlm/lockspace section */
-
-static int get_weight_lockspace(char *node, char *lockspace)
-{
- char path[PATH_MAX], *str;
- int error, weight;
- int master_count = 0, node_is_master = 0;
-
- memset(path, 0, PATH_MAX);
- sprintf(path, MASTER_NAME, lockspace);
-
- while (1) {
- error = ccs_get_list(ccs_handle, path, &str);
- if (error || !str)
- break;
- master_count++;
- if (strcmp(str, node) == 0)
- node_is_master = 1;
- free(str);
- }
-
- /* if there are no masters, next check for a clusternode weight */
-
- if (!master_count)
- return -1;
-
- /* if there's a master and this node isn't it, it gets weight 0 */
-
- if (!node_is_master)
- return 0;
-
- /* master gets its specified weight or 1 if none is given */
-
- memset(path, 0, PATH_MAX);
- sprintf(path, MASTER_WEIGHT, lockspace, node);
-
- error = ccs_get(ccs_handle, path, &str);
- if (error || !str)
- return 1;
-
- weight = atoi(str);
- free(str);
- return weight;
-}
-
-/* look for node's weight on its clusternode line */
-
-static int get_weight_clusternode(char *node, char *lockspace)
+int get_weight(int nodeid, char *lockspace)
{
- char path[PATH_MAX], *str;
- int error, weight;
-
- memset(path, 0, PATH_MAX);
- sprintf(path, WEIGHT_PATH, node);
-
- error = ccs_get(ccs_handle, path, &str);
- if (error || !str)
- return -1;
-
- weight = atoi(str);
- free(str);
- return weight;
+ /* default weight is 1 */
+ return 1;
}
-static int nodeid2name(int nodeid, char *name_out)
+static void proto_val(char *str, int *val)
{
- char path[PATH_MAX];
- char *str, *name;
- int i, error;
-
- for (i = 1; ; i++) {
- str = NULL;
- memset(path, 0, sizeof(path));
- sprintf(path, "/cluster/clusternodes/clusternode[%d]/@nodeid", i);
-
- error = ccs_get(ccs_handle, path, &str);
- if (error || !str)
- break;
-
- if (atoi(str) != nodeid) {
- free(str);
- continue;
- }
- free(str);
-
- name = NULL;
- memset(path, 0, sizeof(path));
- sprintf(path, "/cluster/clusternodes/clusternode[%d]/@name", i);
-
- error = ccs_get(ccs_handle, path, &name);
- if (error || !name) {
- log_error("node name query failed for num %d nodeid %d",
- i, nodeid);
- break;
- }
-
- strncpy(name_out, name, PATH_MAX);
- free(name);
- return 0;
+ if (!strncasecmp(str, "tcp", 3))
+ *val = PROTO_TCP;
+ else if (!strncasecmp(str, "sctp", 4))
+ *val = PROTO_SCTP;
+ else if (!strncasecmp(str, "detect", 6))
+ *val = PROTO_DETECT;
+ else {
+ log_error("invalid protocol value %s", str);
}
-
- return -1;
}
-int get_weight(int nodeid, char *lockspace)
+static void set_val(xmlNode *root, const char *name, int *opt, int *val)
{
- char nodename[PATH_MAX];
- int w, rv;
+ xmlChar *str;
- memset(nodename, 0, sizeof(nodename));
-
- rv = nodeid2name(nodeid, nodename);
- if (rv < 0) {
- log_error("no name for nodeid %d", nodeid);
- w = 1;
- goto out;
+ str = xmlGetProp(root, BAD_CAST name);
+ if (str && !(*opt)) {
+ *val = atoi((char *)str);
+ log_debug("config %s = %d", name, *val);
}
-
- w = get_weight_lockspace(nodename, lockspace);
- if (w >= 0)
- goto out;
-
- w = get_weight_clusternode(nodename, lockspace);
- if (w >= 0)
- goto out;
-
- /* default weight is 1 */
- w = 1;
- out:
- return w;
}
-void read_ccs_name(const char *path, char *name)
+void setup_config(int update)
{
- char *str;
- int error;
+ xmlDoc *doc;
+ xmlNode *root;
+ xmlChar *str;
- error = ccs_get(ccs_handle, path, &str);
- if (error || !str)
+ if (!path_exists(DLM_CONFIG_FILE))
return;
- strcpy(name, str);
-
- free(str);
-}
-
-void read_ccs_yesno(const char *path, int *yes, int *no)
-{
- char *str;
- int error;
-
- *yes = 0;
- *no = 0;
-
- error = ccs_get(ccs_handle, path, &str);
- if (error || !str)
+ doc = xmlParseFile(DLM_CONFIG_FILE);
+ if (!doc) {
+ log_error("xml parse error %d %s", errno, DLM_CONFIG_FILE);
return;
-
- if (!strcmp(str, "yes"))
- *yes = 1;
-
- else if (!strcmp(str, "no"))
- *no = 1;
-
- free(str);
-}
-
-int read_ccs_int(const char *path, int *config_val)
-{
- char *str;
- int val;
- int error;
-
- error = ccs_get(ccs_handle, path, &str);
- if (error || !str)
- return -1;
-
- val = atoi(str);
-
- if (val < 0) {
- log_error("ignore invalid value %d for %s", val, path);
- return -1;
}
- *config_val = val;
- log_debug("%s is %u", path, val);
- free(str);
- return 0;
-}
-
-static void read_ccs_protocol(const char *path, int *config_val)
-{
- char *str;
- int val;
- int error;
-
- error = ccs_get(ccs_handle, path, &str);
- if (error || !str)
- return;
-
- if (!strncasecmp(str, "tcp", 3))
- val = PROTO_TCP;
- else if (!strncasecmp(str, "sctp", 4))
- val = PROTO_SCTP;
- else if (!strncasecmp(str, "detect", 6))
- val = PROTO_DETECT;
- else {
- log_error("ignore invalid value %s for %s", str, path);
+ root = xmlDocGetRootElement(doc);
+ if (!root) {
+ log_error("xml root error %d %s", errno, DLM_CONFIG_FILE);
+ xmlFreeDoc(doc);
return;
}
- *config_val = val;
- log_debug("%s is %u (%s)", path, val, str);
- free(str);
-}
-
-#define DEBUG_PATH "/cluster/dlm/@log_debug"
-#define TIMEWARN_PATH "/cluster/dlm/@timewarn"
-#define PROTOCOL_PATH "/cluster/dlm/@protocol"
-#define ENABLE_FENCING_PATH "/cluster/dlm/@enable_fencing"
-#define ENABLE_QUORUM_PATH "/cluster/dlm/@enable_quorum"
-#define ENABLE_DEADLK_PATH "/cluster/dlm/@enable_deadlk"
-#define ENABLE_PLOCK_PATH "/cluster/dlm/@enable_plock"
-#define PLOCK_DEBUG_PATH "/cluster/dlm/@plock_debug"
-#define PLOCK_RATE_LIMIT_PATH "/cluster/dlm/@plock_rate_limit"
-#define PLOCK_OWNERSHIP_PATH "/cluster/dlm/@plock_ownership"
-#define DROP_RESOURCES_TIME_PATH "/cluster/dlm/@drop_resources_time"
-#define DROP_RESOURCES_COUNT_PATH "/cluster/dlm/@drop_resources_count"
-#define DROP_RESOURCES_AGE_PATH "/cluster/dlm/@drop_resources_age"
-
-/* for backward-compat */
-#define GFS_PLOCK_RATE_LIMIT_PATH "/cluster/gfs_controld/@plock_rate_limit"
-#define GFS_PLOCK_OWNERSHIP_PATH "/cluster/gfs_controld/@plock_ownership"
-#define GFS_DROP_RESOURCES_TIME_PATH "/cluster/gfs_controld/@drop_resources_time"
-#define GFS_DROP_RESOURCES_COUNT_PATH "/cluster/gfs_controld/@drop_resources_count"
-#define GFS_DROP_RESOURCES_AGE_PATH "/cluster/gfs_controld/@drop_resources_age"
-
-int setup_ccs(void)
-{
- int cd, rv;
-
- /* skip things that cannot be changed while running */
- if (ccs_handle)
- goto update;
+ if (update)
+ goto do_update;
- cd = ccs_connect();
- if (cd < 0) {
- log_error("ccs_connect error %d %d", cd, errno);
- return -1;
- }
- ccs_handle = cd;
-
- /* These config values are set from cluster.conf only if they haven't
+ /* These config values are set from dlm.conf only if they haven't
already been set on the command line. */
- if (!optk_debug)
- read_ccs_int(DEBUG_PATH, &cfgk_debug);
- if (!optk_timewarn)
- read_ccs_int(TIMEWARN_PATH, &cfgk_timewarn);
- if (!optk_protocol)
- read_ccs_protocol(PROTOCOL_PATH, &cfgk_protocol);
- if (!optd_enable_fencing)
- read_ccs_int(ENABLE_FENCING_PATH, &cfgd_enable_fencing);
- if (!optd_enable_quorum)
- read_ccs_int(ENABLE_QUORUM_PATH, &cfgd_enable_quorum);
- if (!optd_enable_deadlk)
- read_ccs_int(ENABLE_DEADLK_PATH, &cfgd_enable_deadlk);
- if (!optd_enable_plock)
- read_ccs_int(ENABLE_PLOCK_PATH, &cfgd_enable_plock);
- if (!optd_plock_ownership) {
- rv = read_ccs_int(PLOCK_OWNERSHIP_PATH, &cfgd_plock_ownership);
- if (rv < 0)
- read_ccs_int(GFS_PLOCK_OWNERSHIP_PATH, &cfgd_plock_ownership);
+ str = xmlGetProp(root, BAD_CAST "protocol");
+ if (str && !optk_protocol) {
+ proto_val((char *)str, &cfgk_protocol);
+ log_debug("config protocol = %d", cfgk_protocol);
}
+ set_val(root, "log_debug", &optk_debug, &cfgk_debug);
+ set_val(root, "timewarn", &optk_timewarn, &cfgk_timewarn);
+ set_val(root, "enable_fencing", &optd_enable_fencing, &cfgd_enable_fencing);
+ set_val(root, "enable_quorum", &optd_enable_quorum, &cfgd_enable_quorum);
+ set_val(root, "enable_plock", &optd_enable_plock, &cfgd_enable_plock);
+ set_val(root, "plock_ownership", &optd_plock_ownership, &cfgd_plock_ownership);
+ do_update:
/* The following can be changed while running */
- update:
- if (!optd_plock_debug) {
- read_ccs_int(PLOCK_DEBUG_PATH, &cfgd_plock_debug);
- }
- if (!optd_plock_rate_limit) {
- rv = read_ccs_int(PLOCK_RATE_LIMIT_PATH, &cfgd_plock_rate_limit);
- if (rv < 0)
- read_ccs_int(GFS_PLOCK_RATE_LIMIT_PATH, &cfgd_plock_rate_limit);
- }
- if (!optd_drop_resources_time) {
- rv = read_ccs_int(DROP_RESOURCES_TIME_PATH, &cfgd_drop_resources_time);
- if (rv < 0)
- read_ccs_int(GFS_DROP_RESOURCES_TIME_PATH, &cfgd_drop_resources_time);
- }
- if (!optd_drop_resources_count) {
- rv = read_ccs_int(DROP_RESOURCES_COUNT_PATH, &cfgd_drop_resources_count);
- if (rv < 0)
- read_ccs_int(GFS_DROP_RESOURCES_COUNT_PATH, &cfgd_drop_resources_count);
- }
- if (!optd_drop_resources_age) {
- rv = read_ccs_int(DROP_RESOURCES_AGE_PATH, &cfgd_drop_resources_age);
- if (rv < 0)
- read_ccs_int(GFS_DROP_RESOURCES_AGE_PATH, &cfgd_drop_resources_age);
- }
+ set_val(root, "plock_debug", &optd_plock_debug, &cfgd_plock_debug);
+ set_val(root, "plock_rate_limit", &optd_plock_rate_limit, &cfgd_plock_rate_limit);
+ set_val(root, "drop_resources_time", &optd_drop_resources_time, &cfgd_drop_resources_time);
+ set_val(root, "drop_resources_count", &optd_drop_resources_count, &cfgd_drop_resources_count);
+ set_val(root, "drop_resources_age", &optd_drop_resources_age, &cfgd_drop_resources_age);
- return 0;
-}
-
-void close_ccs(void)
-{
- ccs_disconnect(ccs_handle);
+ xmlFreeDoc(doc);
}
diff --git a/group/dlm_controld/config.h b/group/dlm_controld/config.h
index e575023..ab37eed 100644
--- a/group/dlm_controld/config.h
+++ b/group/dlm_controld/config.h
@@ -7,7 +7,6 @@
#define DEFAULT_DEBUG_LOGFILE 0
#define DEFAULT_ENABLE_FENCING 1
#define DEFAULT_ENABLE_QUORUM 0
-#define DEFAULT_ENABLE_DEADLK 0
#define DEFAULT_ENABLE_PLOCK 1
#define DEFAULT_PLOCK_DEBUG 0
#define DEFAULT_PLOCK_RATE_LIMIT 0
@@ -22,7 +21,6 @@ extern int optk_protocol;
extern int optd_debug_logfile;
extern int optd_enable_fencing;
extern int optd_enable_quorum;
-extern int optd_enable_deadlk;
extern int optd_enable_plock;
extern int optd_plock_debug;
extern int optd_plock_rate_limit;
@@ -37,7 +35,6 @@ extern int cfgk_protocol;
extern int cfgd_debug_logfile;
extern int cfgd_enable_fencing;
extern int cfgd_enable_quorum;
-extern int cfgd_enable_deadlk;
extern int cfgd_enable_plock;
extern int cfgd_plock_debug;
extern int cfgd_plock_rate_limit;
diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c
index f4be240..b3c1454 100644
--- a/group/dlm_controld/cpg.c
+++ b/group/dlm_controld/cpg.c
@@ -1,5 +1,4 @@
#include "dlm_daemon.h"
-#include "config.h"
struct protocol_version {
uint16_t major;
diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h
index 6ac1651..0c89f67 100644
--- a/group/dlm_controld/dlm_daemon.h
+++ b/group/dlm_controld/dlm_daemon.h
@@ -1,8 +1,6 @@
#ifndef __DLM_DAEMON_DOT_H__
#define __DLM_DAEMON_DOT_H__
-#include "clusterautoconfig.h"
-
#include <sys/types.h>
#include <asm/types.h>
#include <sys/uio.h>
@@ -40,9 +38,28 @@
#include <linux/dlmconstants.h>
#include "libdlmcontrol.h"
#include "dlm_controld.h"
+#include "config.h"
#include "list.h"
-#include "linux_endian.h"
#include "rbtree.h"
+#include "linux_endian.h"
+
+/* TODO: cleanup */
+#define CLUSTERVARLIB "/var/lib/cluster"
+#define CLUSTERVARRUN "/var/run/cluster"
+#define LOGDIR "/var/log/cluster"
+#define VERSION "master"
+#define SYSLOGFACILITY LOG_LOCAL4
+#define SYSLOGLEVEL LOG_INFO
+#define REDHAT_COPYRIGHT "Copyright (C) Red Hat, Inc. 2004-2011 All rights reserved."
+#define LOCKFILE_NAME CLUSTERVARRUN "/dlm_controld.pid"
+#define DAEMON_NAME "dlm_controld"
+#define DEFAULT_LOG_MODE LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG
+#define DEFAULT_SYSLOG_FACILITY SYSLOGFACILITY
+#define DEFAULT_SYSLOG_PRIORITY SYSLOGLEVEL
+#define DEFAULT_LOGFILE_PRIORITY LOG_INFO /* ? */
+#define DEFAULT_LOGFILE LOGDIR "/" DAEMON_NAME ".log"
+#define DLM_CONFIG_FILE "/etc/dlm.conf"
+
/* DLM_LOCKSPACE_LEN: maximum lockspace name length, from linux/dlmconstants.h.
Copied in libdlm.h so apps don't need to include the kernel header.
@@ -204,13 +221,10 @@ void clear_configfs(void);
int setup_configfs(void);
int check_uncontrolled_lockspaces(void);
int setup_misc_devices(void);
+int path_exists(const char *path);
/* config.c */
-int setup_ccs(void);
-void close_ccs(void);
-void read_ccs_name(const char *path, char *name);
-void read_ccs_yesno(const char *path, int *yes, int *no);
-int read_ccs_int(const char *path, int *config_val);
+void setup_config(int update);
int get_weight(int nodeid, char *lockspace);
/* cpg.c */
diff --git a/group/dlm_controld/logging.c b/group/dlm_controld/logging.c
index 04f48c7..e6e82b7 100644
--- a/group/dlm_controld/logging.c
+++ b/group/dlm_controld/logging.c
@@ -1,15 +1,4 @@
#include "dlm_daemon.h"
-#include "config.h"
-#include "ccs.h"
-
-extern int ccs_handle;
-
-#define DAEMON_NAME "dlm_controld"
-#define DEFAULT_LOG_MODE LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG
-#define DEFAULT_SYSLOG_FACILITY SYSLOGFACILITY
-#define DEFAULT_SYSLOG_PRIORITY SYSLOGLEVEL
-#define DEFAULT_LOGFILE_PRIORITY LOG_INFO /* ? */
-#define DEFAULT_LOGFILE LOGDIR "/" DAEMON_NAME ".log"
static int log_mode;
static int syslog_facility;
@@ -41,10 +30,13 @@ void init_logging(void)
void setup_logging(void)
{
+ /* TODO */
+ /*
ccs_read_logging(ccs_handle, DAEMON_NAME,
&cfgd_debug_logfile, &log_mode,
&syslog_facility, &syslog_priority,
&logfile_priority, logfile);
+ */
log_debug("logging mode %d syslog f %d p %d logfile p %d %s",
log_mode, syslog_facility, syslog_priority,
diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c
index 0f6f13a..b0d9b03 100644
--- a/group/dlm_controld/main.c
+++ b/group/dlm_controld/main.c
@@ -1,16 +1,10 @@
#include "dlm_daemon.h"
-#include "config.h"
#include <pthread.h>
-#include "copyright.cf"
-
-#include <linux/dlmconstants.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/dlm_netlink.h>
-#define LOCKFILE_NAME CLUSTERVARRUN "/dlm_controld.pid"
#define CLIENT_NALLOC 32
-
static int client_maxi;
static int client_size = 0;
static struct client *client = NULL;
@@ -872,9 +866,7 @@ static void loop(void)
goto out;
client_add(rv, process_cluster, cluster_dead);
- rv = setup_ccs();
- if (rv < 0)
- goto out;
+ setup_config(0);
setup_logging();
@@ -987,7 +979,6 @@ static void loop(void)
close_cpg_daemon();
clear_configfs();
close_logging();
- close_ccs();
close_cluster();
close_cluster_cfg();
@@ -1116,11 +1107,6 @@ static void read_arguments(int argc, char **argv)
cfgd_enable_quorum = atoi(optarg);
break;
- case 'd':
- optd_enable_deadlk = 1;
- cfgd_enable_deadlk = atoi(optarg);
- break;
-
case 'p':
optd_enable_plock = 1;
cfgd_enable_plock = atoi(optarg);
@@ -1261,7 +1247,6 @@ int optk_protocol;
int optd_debug_logfile;
int optd_enable_fencing;
int optd_enable_quorum;
-int optd_enable_deadlk;
int optd_enable_plock;
int optd_plock_debug;
int optd_plock_rate_limit;
@@ -1279,7 +1264,6 @@ int cfgk_protocol = PROTO_DETECT;
int cfgd_debug_logfile = DEFAULT_DEBUG_LOGFILE;
int cfgd_enable_fencing = DEFAULT_ENABLE_FENCING;
int cfgd_enable_quorum = DEFAULT_ENABLE_QUORUM;
-int cfgd_enable_deadlk = DEFAULT_ENABLE_DEADLK;
int cfgd_enable_plock = DEFAULT_ENABLE_PLOCK;
int cfgd_plock_debug = DEFAULT_PLOCK_DEBUG;
int cfgd_plock_rate_limit = DEFAULT_PLOCK_RATE_LIMIT;
diff --git a/group/dlm_controld/member_cman.c b/group/dlm_controld/member_cman.c
index a62ec36..909c249 100644
--- a/group/dlm_controld/member_cman.c
+++ b/group/dlm_controld/member_cman.c
@@ -1,5 +1,4 @@
#include "dlm_daemon.h"
-#include "config.h"
#include <corosync/corotypes.h>
#include <corosync/cfg.h>
#include <corosync/quorum.h>
diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
index 308eeae..c38b998 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -1,6 +1,4 @@
#include "dlm_daemon.h"
-#include "config.h"
-
#include <linux/dlm_plock.h>
/* FIXME: remove this once everyone is using the version of
12 years, 7 months
cluster: RHEL6 - gfs_controld: full check for member changes
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 0fac6d9e86424411289bf7926bc6f8c6805082e9
Parent: d5ba0b947a8995b83df94c08497c451e4ad867ee
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 28 11:34:31 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 28 11:34:31 2011 -0500
gfs_controld: full check for member changes
cman members are queried in response to a callback,
and members sometimes leave and rejoin between queries
(e.g. when they leave and rejoin before corosync
detects they left.)
This means that simply checking if a node is a member
in consecutive queries sometimes misses events. We
need to compare the incarnation numbers of members
from consecutive queries to avoid this.
bz 663397
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/gfs_controld/member_cman.c | 51 +++++++++++++++++++++++++++++++++++---
1 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/group/gfs_controld/member_cman.c b/group/gfs_controld/member_cman.c
index 277a11e..7f354b1 100644
--- a/group/gfs_controld/member_cman.c
+++ b/group/gfs_controld/member_cman.c
@@ -9,6 +9,7 @@ static cman_node_t old_nodes[MAX_NODES];
static int old_node_count;
static cman_node_t cman_nodes[MAX_NODES];
static int cman_node_count;
+static uint32_t cluster_ringid_seq;
void kick_node_from_cluster(int nodeid)
{
@@ -22,6 +23,17 @@ void kick_node_from_cluster(int nodeid)
}
}
+static cman_node_t *get_node(cman_node_t *node_list, int count, int nodeid)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (node_list[i].cn_nodeid == nodeid)
+ return &node_list[i];
+ }
+ return NULL;
+}
+
static int is_member(cman_node_t *node_list, int count, int nodeid)
{
int i;
@@ -45,8 +57,18 @@ static int is_cluster_member(int nodeid)
static void statechange(void)
{
+ cman_cluster_t info;
+ cman_node_t *old;
int i, rv;
+ rv = cman_get_cluster(ch, &info);
+ if (rv < 0) {
+ log_error("cman_get_cluster error %d %d", rv, errno);
+ /* keep going, this is just informational */
+ memset(&info, 0, sizeof(info));
+ }
+ cluster_ringid_seq = info.ci_generation;
+
old_node_count = cman_node_count;
memcpy(&old_nodes, &cman_nodes, sizeof(old_nodes));
@@ -70,8 +92,8 @@ static void statechange(void)
if (old_nodes[i].cn_member &&
!is_cluster_member(old_nodes[i].cn_nodeid)) {
- log_debug("cluster node %d removed",
- old_nodes[i].cn_nodeid);
+ log_debug("cluster node %d removed seq %u",
+ old_nodes[i].cn_nodeid, cluster_ringid_seq);
node_history_cluster_remove(old_nodes[i].cn_nodeid);
}
@@ -81,10 +103,31 @@ static void statechange(void)
if (cman_nodes[i].cn_member &&
!is_old_member(cman_nodes[i].cn_nodeid)) {
- log_debug("cluster node %d added",
- cman_nodes[i].cn_nodeid);
+ log_debug("cluster node %d added seq %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq);
node_history_cluster_add(cman_nodes[i].cn_nodeid);
+ } else {
+ /* look for any nodes that were members of both
+ * old and new but have a new incarnation number
+ * from old to new, indicating they left and rejoined
+ * in between */
+
+ old = get_node(old_nodes, old_node_count, cman_nodes[i].cn_nodeid);
+
+ if (!old)
+ continue;
+ if (cman_nodes[i].cn_incarnation == old->cn_incarnation)
+ continue;
+
+ log_debug("cluster node %d removed and added seq %u "
+ "old %u new %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq,
+ old->cn_incarnation,
+ cman_nodes[i].cn_incarnation);
+
+ node_history_cluster_remove(cman_nodes[i].cn_nodeid);
+ node_history_cluster_add(cman_nodes[i].cn_nodeid);
}
}
}
12 years, 7 months
cluster: RHEL6 - gfs_controld: full check for member changes
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 0fac6d9e86424411289bf7926bc6f8c6805082e9
Parent: d5ba0b947a8995b83df94c08497c451e4ad867ee
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 28 11:34:31 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 28 11:34:31 2011 -0500
gfs_controld: full check for member changes
cman members are queried in response to a callback,
and members sometimes leave and rejoin between queries
(e.g. when they leave and rejoin before corosync
detects they left.)
This means that simply checking if a node is a member
in consecutive queries sometimes misses events. We
need to compare the incarnation numbers of members
from consecutive queries to avoid this.
bz 663397
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/gfs_controld/member_cman.c | 51 +++++++++++++++++++++++++++++++++++---
1 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/group/gfs_controld/member_cman.c b/group/gfs_controld/member_cman.c
index 277a11e..7f354b1 100644
--- a/group/gfs_controld/member_cman.c
+++ b/group/gfs_controld/member_cman.c
@@ -9,6 +9,7 @@ static cman_node_t old_nodes[MAX_NODES];
static int old_node_count;
static cman_node_t cman_nodes[MAX_NODES];
static int cman_node_count;
+static uint32_t cluster_ringid_seq;
void kick_node_from_cluster(int nodeid)
{
@@ -22,6 +23,17 @@ void kick_node_from_cluster(int nodeid)
}
}
+static cman_node_t *get_node(cman_node_t *node_list, int count, int nodeid)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (node_list[i].cn_nodeid == nodeid)
+ return &node_list[i];
+ }
+ return NULL;
+}
+
static int is_member(cman_node_t *node_list, int count, int nodeid)
{
int i;
@@ -45,8 +57,18 @@ static int is_cluster_member(int nodeid)
static void statechange(void)
{
+ cman_cluster_t info;
+ cman_node_t *old;
int i, rv;
+ rv = cman_get_cluster(ch, &info);
+ if (rv < 0) {
+ log_error("cman_get_cluster error %d %d", rv, errno);
+ /* keep going, this is just informational */
+ memset(&info, 0, sizeof(info));
+ }
+ cluster_ringid_seq = info.ci_generation;
+
old_node_count = cman_node_count;
memcpy(&old_nodes, &cman_nodes, sizeof(old_nodes));
@@ -70,8 +92,8 @@ static void statechange(void)
if (old_nodes[i].cn_member &&
!is_cluster_member(old_nodes[i].cn_nodeid)) {
- log_debug("cluster node %d removed",
- old_nodes[i].cn_nodeid);
+ log_debug("cluster node %d removed seq %u",
+ old_nodes[i].cn_nodeid, cluster_ringid_seq);
node_history_cluster_remove(old_nodes[i].cn_nodeid);
}
@@ -81,10 +103,31 @@ static void statechange(void)
if (cman_nodes[i].cn_member &&
!is_old_member(cman_nodes[i].cn_nodeid)) {
- log_debug("cluster node %d added",
- cman_nodes[i].cn_nodeid);
+ log_debug("cluster node %d added seq %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq);
node_history_cluster_add(cman_nodes[i].cn_nodeid);
+ } else {
+ /* look for any nodes that were members of both
+ * old and new but have a new incarnation number
+ * from old to new, indicating they left and rejoined
+ * in between */
+
+ old = get_node(old_nodes, old_node_count, cman_nodes[i].cn_nodeid);
+
+ if (!old)
+ continue;
+ if (cman_nodes[i].cn_incarnation == old->cn_incarnation)
+ continue;
+
+ log_debug("cluster node %d removed and added seq %u "
+ "old %u new %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq,
+ old->cn_incarnation,
+ cman_nodes[i].cn_incarnation);
+
+ node_history_cluster_remove(cman_nodes[i].cn_nodeid);
+ node_history_cluster_add(cman_nodes[i].cn_nodeid);
}
}
}
12 years, 7 months
cluster: RHEL6 - dlm_controld: full check for member changes
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: d5ba0b947a8995b83df94c08497c451e4ad867ee
Parent: 867534832d5cc642a3c0692c2599cd01d38026e5
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 28 11:33:50 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 28 11:33:50 2011 -0500
dlm_controld: full check for member changes
cman members are queried in response to a callback,
and members sometimes leave and rejoin between queries
(e.g. when they leave and rejoin before corosync
detects they left.)
This means that simply checking if a node is a member
in consecutive queries sometimes misses events. We
need to compare the incarnation numbers of members
from consecutive queries to avoid this.
bz 663397
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/dlm_controld/member_cman.c | 79 ++++++++++++++++++++++++++++++++++++--
1 files changed, 75 insertions(+), 4 deletions(-)
diff --git a/group/dlm_controld/member_cman.c b/group/dlm_controld/member_cman.c
index c6b7cc7..2b115d5 100644
--- a/group/dlm_controld/member_cman.c
+++ b/group/dlm_controld/member_cman.c
@@ -9,6 +9,7 @@ static cman_node_t old_nodes[MAX_NODES];
static int old_node_count;
static cman_node_t cman_nodes[MAX_NODES];
static int cman_node_count;
+static uint32_t cluster_ringid_seq;
void kick_node_from_cluster(int nodeid)
{
@@ -22,6 +23,17 @@ void kick_node_from_cluster(int nodeid)
}
}
+static cman_node_t *get_node(cman_node_t *node_list, int count, int nodeid)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (node_list[i].cn_nodeid == nodeid)
+ return &node_list[i];
+ }
+ return NULL;
+}
+
static int is_member(cman_node_t *node_list, int count, int nodeid)
{
int i;
@@ -69,11 +81,21 @@ char *nodeid2name(int nodeid)
static void statechange(void)
{
+ cman_cluster_t info;
+ cman_node_t *old;
int i, j, rv;
struct cman_node_address addrs[MAX_NODE_ADDRESSES];
int num_addrs;
struct cman_node_address *addrptr = addrs;
+ rv = cman_get_cluster(ch, &info);
+ if (rv < 0) {
+ log_error("cman_get_cluster error %d %d", rv, errno);
+ /* keep going, this is just informational */
+ memset(&info, 0, sizeof(info));
+ }
+ cluster_ringid_seq = info.ci_generation;
+
cluster_quorate = cman_is_quorate(ch);
old_node_count = cman_node_count;
@@ -99,8 +121,8 @@ static void statechange(void)
if (old_nodes[i].cn_member &&
!is_cluster_member(old_nodes[i].cn_nodeid)) {
- log_debug("cluster node %d removed",
- old_nodes[i].cn_nodeid);
+ log_debug("cluster node %d removed seq %u",
+ old_nodes[i].cn_nodeid, cluster_ringid_seq);
node_history_cluster_remove(old_nodes[i].cn_nodeid);
@@ -112,6 +134,9 @@ static void statechange(void)
if (cman_nodes[i].cn_member &&
!is_old_member(cman_nodes[i].cn_nodeid)) {
+ log_debug("cluster node %d added seq %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq);
+
rv = cman_get_node_addrs(ch, cman_nodes[i].cn_nodeid,
MAX_NODE_ADDRESSES,
&num_addrs, addrs);
@@ -121,8 +146,54 @@ static void statechange(void)
addrptr = &cman_nodes[i].cn_address;
}
- log_debug("cluster node %d added",
- cman_nodes[i].cn_nodeid);
+ node_history_cluster_add(cman_nodes[i].cn_nodeid);
+
+ for (j = 0; j < num_addrs; j++) {
+ add_configfs_node(cman_nodes[i].cn_nodeid,
+ addrptr[j].cna_address,
+ addrptr[j].cna_addrlen,
+ (cman_nodes[i].cn_nodeid ==
+ our_nodeid));
+ }
+ } else {
+ /* look for any nodes that were members of both
+ * old and new but have a new incarnation number
+ * from old to new, indicating they left and rejoined
+ * in between */
+
+ old = get_node(old_nodes, old_node_count, cman_nodes[i].cn_nodeid);
+
+ if (!old)
+ continue;
+ if (cman_nodes[i].cn_incarnation == old->cn_incarnation)
+ continue;
+
+ log_debug("cluster node %d removed and added seq %u "
+ "old %u new %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq,
+ old->cn_incarnation,
+ cman_nodes[i].cn_incarnation);
+
+ /*
+ * remove (copied from above)
+ */
+
+ node_history_cluster_remove(old_nodes[i].cn_nodeid);
+
+ del_configfs_node(old_nodes[i].cn_nodeid);
+
+ /*
+ * add (copied from above)
+ */
+
+ rv = cman_get_node_addrs(ch, cman_nodes[i].cn_nodeid,
+ MAX_NODE_ADDRESSES,
+ &num_addrs, addrs);
+ if (rv < 0) {
+ log_debug("cman_get_node_addrs failed, falling back to single-homed. ");
+ num_addrs = 1;
+ addrptr = &cman_nodes[i].cn_address;
+ }
node_history_cluster_add(cman_nodes[i].cn_nodeid);
12 years, 7 months
cluster: RHEL6 - fenced: full check for member changes
by Fabio M. Di Nitto
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 867534832d5cc642a3c0692c2599cd01d38026e5
Parent: c1421b402bbc86aae0940c05fa5684e46ac93c9c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 28 11:03:32 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 28 11:03:32 2011 -0500
fenced: full check for member changes
cman members are queried in response to a callback,
and members sometimes leave and rejoin between queries
(e.g. when they leave and rejoin before corosync
detects they left.)
This means that simply checking if a node is a member
in consecutive queries sometimes misses events. We
need to compare the incarnation numbers of members
from consecutive queries to avoid this.
bz 663397
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
fence/fenced/member_cman.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/fence/fenced/member_cman.c b/fence/fenced/member_cman.c
index 0919b8e..ee879be 100644
--- a/fence/fenced/member_cman.c
+++ b/fence/fenced/member_cman.c
@@ -33,6 +33,17 @@ void kick_node_from_cluster(int nodeid)
}
}
+static cman_node_t *get_node(cman_node_t *node_list, int count, int nodeid)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (node_list[i].cn_nodeid == nodeid)
+ return &node_list[i];
+ }
+ return NULL;
+}
+
static int is_member(cman_node_t *node_list, int count, int nodeid)
{
int i;
@@ -149,6 +160,7 @@ int name_to_nodeid(char *name)
static void update_cluster(void)
{
cman_cluster_t info;
+ cman_node_t *old;
int quorate = cluster_quorate;
int removed = 0, added = 0;
int i, rv;
@@ -197,6 +209,30 @@ static void update_cluster(void)
node_history_cluster_add(cman_nodes[i].cn_nodeid);
added++;
+ } else {
+ /* look for any nodes that were members of both
+ * old and new but have a new incarnation number
+ * from old to new, indicating they left and rejoined
+ * in between */
+
+ old = get_node(old_nodes, old_node_count, cman_nodes[i].cn_nodeid);
+
+ if (!old)
+ continue;
+ if (cman_nodes[i].cn_incarnation == old->cn_incarnation)
+ continue;
+
+ log_debug("cluster node %d removed and added seq %u "
+ "old %u new %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq,
+ old->cn_incarnation,
+ cman_nodes[i].cn_incarnation);
+
+ node_history_cluster_remove(cman_nodes[i].cn_nodeid);
+ removed++;
+
+ node_history_cluster_add(cman_nodes[i].cn_nodeid);
+ added++;
}
}
12 years, 7 months
cluster: STABLE31 - dlm_controld: full check for member changes
by David Teigland
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: afe8df67ab28a9fed6ba01a4a952354a012d9b25
Parent: d353712f0b581a5f7e1c39ee88b505b133a55297
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 28 11:33:50 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 28 11:40:47 2011 -0500
dlm_controld: full check for member changes
cman members are queried in response to a callback,
and members sometimes leave and rejoin between queries
(e.g. when they leave and rejoin before corosync
detects they left.)
This means that simply checking if a node is a member
in consecutive queries sometimes misses events. We
need to compare the incarnation numbers of members
from consecutive queries to avoid this.
bz 663397
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/dlm_controld/member_cman.c | 79 ++++++++++++++++++++++++++++++++++++--
1 files changed, 75 insertions(+), 4 deletions(-)
diff --git a/group/dlm_controld/member_cman.c b/group/dlm_controld/member_cman.c
index c6b7cc7..2b115d5 100644
--- a/group/dlm_controld/member_cman.c
+++ b/group/dlm_controld/member_cman.c
@@ -9,6 +9,7 @@ static cman_node_t old_nodes[MAX_NODES];
static int old_node_count;
static cman_node_t cman_nodes[MAX_NODES];
static int cman_node_count;
+static uint32_t cluster_ringid_seq;
void kick_node_from_cluster(int nodeid)
{
@@ -22,6 +23,17 @@ void kick_node_from_cluster(int nodeid)
}
}
+static cman_node_t *get_node(cman_node_t *node_list, int count, int nodeid)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (node_list[i].cn_nodeid == nodeid)
+ return &node_list[i];
+ }
+ return NULL;
+}
+
static int is_member(cman_node_t *node_list, int count, int nodeid)
{
int i;
@@ -69,11 +81,21 @@ char *nodeid2name(int nodeid)
static void statechange(void)
{
+ cman_cluster_t info;
+ cman_node_t *old;
int i, j, rv;
struct cman_node_address addrs[MAX_NODE_ADDRESSES];
int num_addrs;
struct cman_node_address *addrptr = addrs;
+ rv = cman_get_cluster(ch, &info);
+ if (rv < 0) {
+ log_error("cman_get_cluster error %d %d", rv, errno);
+ /* keep going, this is just informational */
+ memset(&info, 0, sizeof(info));
+ }
+ cluster_ringid_seq = info.ci_generation;
+
cluster_quorate = cman_is_quorate(ch);
old_node_count = cman_node_count;
@@ -99,8 +121,8 @@ static void statechange(void)
if (old_nodes[i].cn_member &&
!is_cluster_member(old_nodes[i].cn_nodeid)) {
- log_debug("cluster node %d removed",
- old_nodes[i].cn_nodeid);
+ log_debug("cluster node %d removed seq %u",
+ old_nodes[i].cn_nodeid, cluster_ringid_seq);
node_history_cluster_remove(old_nodes[i].cn_nodeid);
@@ -112,6 +134,9 @@ static void statechange(void)
if (cman_nodes[i].cn_member &&
!is_old_member(cman_nodes[i].cn_nodeid)) {
+ log_debug("cluster node %d added seq %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq);
+
rv = cman_get_node_addrs(ch, cman_nodes[i].cn_nodeid,
MAX_NODE_ADDRESSES,
&num_addrs, addrs);
@@ -121,8 +146,54 @@ static void statechange(void)
addrptr = &cman_nodes[i].cn_address;
}
- log_debug("cluster node %d added",
- cman_nodes[i].cn_nodeid);
+ node_history_cluster_add(cman_nodes[i].cn_nodeid);
+
+ for (j = 0; j < num_addrs; j++) {
+ add_configfs_node(cman_nodes[i].cn_nodeid,
+ addrptr[j].cna_address,
+ addrptr[j].cna_addrlen,
+ (cman_nodes[i].cn_nodeid ==
+ our_nodeid));
+ }
+ } else {
+ /* look for any nodes that were members of both
+ * old and new but have a new incarnation number
+ * from old to new, indicating they left and rejoined
+ * in between */
+
+ old = get_node(old_nodes, old_node_count, cman_nodes[i].cn_nodeid);
+
+ if (!old)
+ continue;
+ if (cman_nodes[i].cn_incarnation == old->cn_incarnation)
+ continue;
+
+ log_debug("cluster node %d removed and added seq %u "
+ "old %u new %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq,
+ old->cn_incarnation,
+ cman_nodes[i].cn_incarnation);
+
+ /*
+ * remove (copied from above)
+ */
+
+ node_history_cluster_remove(old_nodes[i].cn_nodeid);
+
+ del_configfs_node(old_nodes[i].cn_nodeid);
+
+ /*
+ * add (copied from above)
+ */
+
+ rv = cman_get_node_addrs(ch, cman_nodes[i].cn_nodeid,
+ MAX_NODE_ADDRESSES,
+ &num_addrs, addrs);
+ if (rv < 0) {
+ log_debug("cman_get_node_addrs failed, falling back to single-homed. ");
+ num_addrs = 1;
+ addrptr = &cman_nodes[i].cn_address;
+ }
node_history_cluster_add(cman_nodes[i].cn_nodeid);
12 years, 7 months
cluster: STABLE31 - fenced: full check for member changes
by David Teigland
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: d353712f0b581a5f7e1c39ee88b505b133a55297
Parent: e2fe317d5e1c313f5bece465e0e703b0548d50cf
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 28 11:03:32 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 28 11:40:42 2011 -0500
fenced: full check for member changes
cman members are queried in response to a callback,
and members sometimes leave and rejoin between queries
(e.g. when they leave and rejoin before corosync
detects they left.)
This means that simply checking if a node is a member
in consecutive queries sometimes misses events. We
need to compare the incarnation numbers of members
from consecutive queries to avoid this.
bz 663397
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
fence/fenced/member_cman.c | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/fence/fenced/member_cman.c b/fence/fenced/member_cman.c
index 0919b8e..ee879be 100644
--- a/fence/fenced/member_cman.c
+++ b/fence/fenced/member_cman.c
@@ -33,6 +33,17 @@ void kick_node_from_cluster(int nodeid)
}
}
+static cman_node_t *get_node(cman_node_t *node_list, int count, int nodeid)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (node_list[i].cn_nodeid == nodeid)
+ return &node_list[i];
+ }
+ return NULL;
+}
+
static int is_member(cman_node_t *node_list, int count, int nodeid)
{
int i;
@@ -149,6 +160,7 @@ int name_to_nodeid(char *name)
static void update_cluster(void)
{
cman_cluster_t info;
+ cman_node_t *old;
int quorate = cluster_quorate;
int removed = 0, added = 0;
int i, rv;
@@ -197,6 +209,30 @@ static void update_cluster(void)
node_history_cluster_add(cman_nodes[i].cn_nodeid);
added++;
+ } else {
+ /* look for any nodes that were members of both
+ * old and new but have a new incarnation number
+ * from old to new, indicating they left and rejoined
+ * in between */
+
+ old = get_node(old_nodes, old_node_count, cman_nodes[i].cn_nodeid);
+
+ if (!old)
+ continue;
+ if (cman_nodes[i].cn_incarnation == old->cn_incarnation)
+ continue;
+
+ log_debug("cluster node %d removed and added seq %u "
+ "old %u new %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq,
+ old->cn_incarnation,
+ cman_nodes[i].cn_incarnation);
+
+ node_history_cluster_remove(cman_nodes[i].cn_nodeid);
+ removed++;
+
+ node_history_cluster_add(cman_nodes[i].cn_nodeid);
+ added++;
}
}
12 years, 7 months
cluster: RHEL6 - gfs_controld: full check for member changes
by David Teigland
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 0fac6d9e86424411289bf7926bc6f8c6805082e9
Parent: d5ba0b947a8995b83df94c08497c451e4ad867ee
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 28 11:34:31 2011 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 28 11:34:31 2011 -0500
gfs_controld: full check for member changes
cman members are queried in response to a callback,
and members sometimes leave and rejoin between queries
(e.g. when they leave and rejoin before corosync
detects they left.)
This means that simply checking if a node is a member
in consecutive queries sometimes misses events. We
need to compare the incarnation numbers of members
from consecutive queries to avoid this.
bz 663397
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/gfs_controld/member_cman.c | 51 +++++++++++++++++++++++++++++++++++---
1 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/group/gfs_controld/member_cman.c b/group/gfs_controld/member_cman.c
index 277a11e..7f354b1 100644
--- a/group/gfs_controld/member_cman.c
+++ b/group/gfs_controld/member_cman.c
@@ -9,6 +9,7 @@ static cman_node_t old_nodes[MAX_NODES];
static int old_node_count;
static cman_node_t cman_nodes[MAX_NODES];
static int cman_node_count;
+static uint32_t cluster_ringid_seq;
void kick_node_from_cluster(int nodeid)
{
@@ -22,6 +23,17 @@ void kick_node_from_cluster(int nodeid)
}
}
+static cman_node_t *get_node(cman_node_t *node_list, int count, int nodeid)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (node_list[i].cn_nodeid == nodeid)
+ return &node_list[i];
+ }
+ return NULL;
+}
+
static int is_member(cman_node_t *node_list, int count, int nodeid)
{
int i;
@@ -45,8 +57,18 @@ static int is_cluster_member(int nodeid)
static void statechange(void)
{
+ cman_cluster_t info;
+ cman_node_t *old;
int i, rv;
+ rv = cman_get_cluster(ch, &info);
+ if (rv < 0) {
+ log_error("cman_get_cluster error %d %d", rv, errno);
+ /* keep going, this is just informational */
+ memset(&info, 0, sizeof(info));
+ }
+ cluster_ringid_seq = info.ci_generation;
+
old_node_count = cman_node_count;
memcpy(&old_nodes, &cman_nodes, sizeof(old_nodes));
@@ -70,8 +92,8 @@ static void statechange(void)
if (old_nodes[i].cn_member &&
!is_cluster_member(old_nodes[i].cn_nodeid)) {
- log_debug("cluster node %d removed",
- old_nodes[i].cn_nodeid);
+ log_debug("cluster node %d removed seq %u",
+ old_nodes[i].cn_nodeid, cluster_ringid_seq);
node_history_cluster_remove(old_nodes[i].cn_nodeid);
}
@@ -81,10 +103,31 @@ static void statechange(void)
if (cman_nodes[i].cn_member &&
!is_old_member(cman_nodes[i].cn_nodeid)) {
- log_debug("cluster node %d added",
- cman_nodes[i].cn_nodeid);
+ log_debug("cluster node %d added seq %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq);
node_history_cluster_add(cman_nodes[i].cn_nodeid);
+ } else {
+ /* look for any nodes that were members of both
+ * old and new but have a new incarnation number
+ * from old to new, indicating they left and rejoined
+ * in between */
+
+ old = get_node(old_nodes, old_node_count, cman_nodes[i].cn_nodeid);
+
+ if (!old)
+ continue;
+ if (cman_nodes[i].cn_incarnation == old->cn_incarnation)
+ continue;
+
+ log_debug("cluster node %d removed and added seq %u "
+ "old %u new %u",
+ cman_nodes[i].cn_nodeid, cluster_ringid_seq,
+ old->cn_incarnation,
+ cman_nodes[i].cn_incarnation);
+
+ node_history_cluster_remove(cman_nodes[i].cn_nodeid);
+ node_history_cluster_add(cman_nodes[i].cn_nodeid);
}
}
}
12 years, 7 months