cluster: RHEL6 - Fix syntax error in code that opens logfile.
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: fb73a65a93eb6e262e7988b724c0f1feed4beae5
Parent: dbb67ee051f60b03d91cdf7ddba214c7af2db588
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Aug 10 11:55:53 2010 -0500
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Aug 10 11:58:54 2010 -0500
Fix syntax error in code that opens logfile.
rhbz#608887
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 992a3eb..9ee8917 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -583,7 +583,7 @@ else {
## and redirect STDOUT and STDERR to the logfile.
##
if (defined $opt_f) {
- open (LOG, >">$opt_f") or die "$!\n";
+ open (LOG, ">>$opt_f") or die "$!\n";
open (STDOUT, ">&LOG");
open (STDERR, ">&LOG");
}
13 years, 8 months
cluster: STABLE3 - Fix syntax error in code that opens logfile.
by rohara
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 66fde5c0404772facee6d935e69530603a577f97
Parent: 9a5de317a9bf9f9dfc57c6b98ed58a988978c94d
Author: Ryan O'Hara <rohara(a)redhat.com>
AuthorDate: Tue Aug 10 11:55:53 2010 -0500
Committer: Ryan O'Hara <rohara(a)redhat.com>
CommitterDate: Tue Aug 10 11:55:53 2010 -0500
Fix syntax error in code that opens logfile.
rhbz#608887
Signed-off-by: Ryan O'Hara <rohara(a)redhat.com>
---
fence/agents/scsi/fence_scsi.pl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
index 992a3eb..9ee8917 100644
--- a/fence/agents/scsi/fence_scsi.pl
+++ b/fence/agents/scsi/fence_scsi.pl
@@ -583,7 +583,7 @@ else {
## and redirect STDOUT and STDERR to the logfile.
##
if (defined $opt_f) {
- open (LOG, >">$opt_f") or die "$!\n";
+ open (LOG, ">>$opt_f") or die "$!\n";
open (STDOUT, ">&LOG");
open (STDERR, ">&LOG");
}
13 years, 8 months
gfs2-utils: master - tunegfs2: Change default install path /usr/sbin
by goldwyn
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 168ed5337b4425f8d8c6203e3f799ff46659dbd9
Parent: 03034f8b958005aa81debe456020a4c80ca0a6dd
Author: Goldwyn Rodrigues <rgoldwyn(a)gmail.com>
AuthorDate: Mon Aug 9 14:14:42 2010 -0500
Committer: Goldwyn Rodrigues <rgoldwyn(a)gmail.com>
CommitterDate: Mon Aug 9 14:14:42 2010 -0500
tunegfs2: Change default install path /usr/sbin
---
gfs2/tune/Makefile.am | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/gfs2/tune/Makefile.am b/gfs2/tune/Makefile.am
index e11189b..41371bc 100644
--- a/gfs2/tune/Makefile.am
+++ b/gfs2/tune/Makefile.am
@@ -1,13 +1,5 @@
MAINTAINERCLEANFILES = Makefile.in
-# When an exec_prefix setting would have us install into /usr/sbin,
-# use /sbin instead.
-# Accept an existing sbindir value of /usr/sbin (probably for older automake),
-# or an empty value, for automake-1.11 and newer.
-sbindir := $(shell rpl=0; test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
- || test '$(exec_prefix):$(sbindir)' = /usr: && rpl=1; \
- test $$rpl = 1 && echo /sbin || echo '$(exec_prefix)/sbin')
-
sbin_PROGRAMS = tunegfs2
noinst_HEADERS = tunegfs2.h
13 years, 8 months
cluster: RHEL56 - rgmanager: Retry when config is out of sync
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: a4ced3c53b65320f4c67ae5cd53a70e61a32e796
Parent: 801c034863c137ad3dbf3f057057b12f61a79df5
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Thu Aug 5 16:53:22 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Mon Aug 9 10:22:47 2010 -0400
rgmanager: Retry when config is out of sync
If you add a service to rgmanager v1 or v2 and that
service fails to start on the first node but succeeds
in its initial stop operation, there is a chance that
the remote instance of rgmanager has not yet reread
the configuration, causing the service to be placed
into the 'recovering' state without further action.
This patch causes the originator of the request to
retry the operation.
Later versions of rgmanager (ex STABLE3 branch and
derivatives) are unlikely to have this problem since
configuration updates are not polled, but rather
delivered to clients.
Resolves: rhbz#568126
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/rg_state.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 66ed85f..a4fe15e 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1725,6 +1725,7 @@ handle_relocate_req(char *svcName, int orig_request, int preferred_target,
rg_state_t svcStatus;
int target = preferred_target, me = my_id();
int ret, x, request = orig_request;
+ int retries;
get_rg_state_local(svcName, &svcStatus);
if (svcStatus.rs_state == RG_STATE_DISABLED ||
@@ -1855,6 +1856,8 @@ handle_relocate_req(char *svcName, int orig_request, int preferred_target,
if (target == me)
goto exhausted;
+ retries = 0;
+retry:
ret = svc_start_remote(svcName, request, target);
switch (ret) {
case RG_ERUN:
@@ -1864,6 +1867,21 @@ handle_relocate_req(char *svcName, int orig_request, int preferred_target,
*new_owner = svcStatus.rs_owner;
free_member_list(allowed_nodes);
return 0;
+ case RG_ENOSERVICE:
+ /*
+ * Configuration update pending on remote node? Give it
+ * a few seconds to sync up. rhbz#568126
+ *
+ * Configuration updates are synchronized in later releases
+ * of rgmanager; this should not be needed.
+ */
+ if (retries++ < 4) {
+ sleep(3);
+ goto retry;
+ }
+ clulog(LOG_WARNING, "Member #%d has a different configuration"
+ " than I do; trying next member.", target);
+ /* Deliberate */
case RG_EDEPEND:
case RG_EFAIL:
/* Uh oh - we failed to relocate to this node.
13 years, 8 months
gfs2-utils: master - [PATCH 3/3] tunegfs2: Modify Makefiles/configure scripts
by goldwyn
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 03034f8b958005aa81debe456020a4c80ca0a6dd
Parent: fb6372ed083c08c0e66f7f7ebd5bdce64f220921
Author: Goldwyn Rodrigues <rgoldwyn(a)gmail.com>
AuthorDate: Fri Aug 6 21:26:21 2010 -0500
Committer: Goldwyn Rodrigues <rgoldwyn(a)gmail.com>
CommitterDate: Fri Aug 6 21:39:47 2010 -0500
[PATCH 3/3] tunegfs2: Modify Makefiles/configure scripts
rhbz#505061
---
configure.ac | 1 +
gfs2/Makefile.am | 2 +-
gfs2/tune/Makefile.am | 19 +++++++++++++++++++
3 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index bb4fc13..10bcc95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,6 +278,7 @@ AC_CONFIG_FILES([Makefile
gfs2/mount/Makefile
gfs2/quota/Makefile
gfs2/tool/Makefile
+ gfs2/tune/Makefile
gfs2/man/Makefile
doc/Makefile
])
diff --git a/gfs2/Makefile.am b/gfs2/Makefile.am
index d7c969d..9116bd3 100644
--- a/gfs2/Makefile.am
+++ b/gfs2/Makefile.am
@@ -1,4 +1,4 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = libgfs2 convert edit fsck mkfs mount quota tool man \
- include #init.d
+ tune include #init.d
diff --git a/gfs2/tune/Makefile.am b/gfs2/tune/Makefile.am
new file mode 100644
index 0000000..e11189b
--- /dev/null
+++ b/gfs2/tune/Makefile.am
@@ -0,0 +1,19 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+# When an exec_prefix setting would have us install into /usr/sbin,
+# use /sbin instead.
+# Accept an existing sbindir value of /usr/sbin (probably for older automake),
+# or an empty value, for automake-1.11 and newer.
+sbindir := $(shell rpl=0; test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
+ || test '$(exec_prefix):$(sbindir)' = /usr: && rpl=1; \
+ test $$rpl = 1 && echo /sbin || echo '$(exec_prefix)/sbin')
+
+sbin_PROGRAMS = tunegfs2
+
+noinst_HEADERS = tunegfs2.h
+
+tunegfs2_SOURCES = main.c super.c
+
+tunegfs2_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM \
+ -I$(top_srcdir)/gfs2/include \
+ -I$(top_srcdir)/group/include
13 years, 9 months
gfs2-utils: master - [PATCH 2/3] tunegfs2: Add operations to modify the superblock
by goldwyn
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: fb6372ed083c08c0e66f7f7ebd5bdce64f220921
Parent: 5158b880e285481c378d82136eeff30ec5215750
Author: Goldwyn Rodrigues <rgoldwyn(a)gmail.com>
AuthorDate: Fri Aug 6 21:24:10 2010 -0500
Committer: Goldwyn Rodrigues <rgoldwyn(a)gmail.com>
CommitterDate: Fri Aug 6 21:24:10 2010 -0500
[PATCH 2/3] tunegfs2: Add operations to modify the superblock
---
gfs2/tune/super.c | 228 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 228 insertions(+), 0 deletions(-)
diff --git a/gfs2/tune/super.c b/gfs2/tune/super.c
new file mode 100644
index 0000000..1d3e99e
--- /dev/null
+++ b/gfs2/tune/super.c
@@ -0,0 +1,228 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <string.h>
+#include <libintl.h>
+#define _(String) gettext(String)
+#include <linux_endian.h>
+#include <linux/gfs2_ondisk.h>
+#include "tunegfs2.h"
+
+static int str_to_hexchar(const char *estring)
+{
+ int ch = 0;
+
+ if (isdigit(*estring))
+ ch = (*estring - '0') * 0x10;
+ else if (*estring >= 'a' && *estring <= 'f')
+ ch = (*estring - 'a' + 0x0a) * 0x10;
+ else if (*estring >= 'A' && *estring <= 'F')
+ ch = (*estring - 'A' + 0x0a) * 0x10;
+
+ estring++;
+ if (isdigit(*estring))
+ ch += (*estring - '0');
+ else if (*estring >= 'a' && *estring <= 'f')
+ ch += (*estring - 'a' + 0x0a);
+ else if (*estring >= 'A' && *estring <= 'F')
+ ch += (*estring - 'A' + 0x0a);
+ return ch;
+}
+
+
+
+static const char *uuid2str(const unsigned char *uuid)
+{
+ static char str[64];
+ char *ch;
+ int i;
+
+ memset(str, 0, 64);
+ ch = str;
+ for (i = 0; i < 16; i++) {
+ sprintf(ch, "%02X", uuid[i]);
+ ch += 2;
+ if ((i == 3) || (i == 5) || (i == 7) || (i == 9)) {
+ *ch = '-';
+ ch++;
+ }
+ }
+ return str;
+}
+
+static int str2uuid(const char *newval, char *uuid)
+{
+ char *cp;
+ int i;
+
+ if (strlen(newval) != 36) {
+ fprintf(stderr, _("Invalid UUID specified.\n"));
+ return -EINVAL;
+ }
+
+ cp = uuid;
+ for (i = 0; i < 36; i++) {
+ if ((i == 8) || (i == 13) ||
+ (i == 18) || (i == 23)) {
+ if (newval[i] == '-')
+ continue;
+ fprintf(stderr, _("uuid %s has an invalid format."),
+ newval);
+ return -EINVAL;
+ }
+ if (!isxdigit(newval[i])) {
+ fprintf(stderr, _("uuid %s has an invalid hex "
+ "digit '%c' at offset %d.\n"),
+ newval, newval[i], i + 1);
+ return -EINVAL;
+ }
+ *cp = str_to_hexchar(&newval[i++]);
+ cp++;
+ }
+ return 0;
+}
+
+int read_super(struct tunegfs2 *tfs)
+{
+ char *block;
+ int n;
+ tfs->sb_start = GFS2_SB_ADDR << GFS2_BASIC_BLOCK_SHIFT;
+ block = (char *)malloc(sizeof(char) * GFS2_DEFAULT_BSIZE);
+ n = pread(tfs->fd, block, GFS2_DEFAULT_BSIZE, tfs->sb_start);
+ if (n < 0) {
+ fprintf(stderr, _("Error reading from device"));
+ return errno;
+ }
+ tfs->sb = (struct gfs2_sb *)(block);
+ if (be32_to_cpu(tfs->sb->sb_header.mh_magic != GFS_MAGIC) &&
+ (be32_to_cpu(tfs->sb->sb_header.mh_magic) != GFS2_MAGIC)) {
+ fprintf(stderr, _("Not a GFS2 device\n"));
+ return -EINVAL;
+ }
+ return 0;
+}
+
+int print_super(struct tunegfs2 *tfs)
+{
+ char *fsname = NULL;
+ int table_len = 0, fsname_len = 0;
+
+ fprintf(stdout, _("Superblock Details\n"));
+ fprintf(stdout, _("Block size: %d\n"), be32_to_cpu(tfs->sb->sb_bsize));
+ fprintf(stdout, _("Block shift: %d\n"), be32_to_cpu(tfs->sb->sb_bsize_shift));
+ fprintf(stdout, _("Locking Protocol: %.*s\n"), GFS2_LOCKNAME_LEN,
+ tfs->sb->sb_lockproto);
+ fsname = strchr(tfs->sb->sb_locktable, ':');
+ if (fsname) {
+ table_len = fsname - tfs->sb->sb_locktable;
+ fsname_len = GFS2_LOCKNAME_LEN - table_len - 1;
+ fsname++;
+ }
+
+ fprintf(stdout, _("lock table: %.*s\n"), table_len,
+ tfs->sb->sb_locktable);
+ fprintf(stdout, _("fsname: %.*s\n"), fsname_len, fsname);
+ if (be32_to_cpu(tfs->sb->sb_header.mh_magic) == GFS2_MAGIC)
+ fprintf(stdout, _("Superblock UUID: %s\n"),
+ uuid2str(tfs->sb->sb_uuid));
+ return 0;
+}
+
+int write_super(struct tunegfs2 *tfs)
+{
+ char *block = (char *)tfs->sb;
+ int n;
+ n = pwrite(tfs->fd, block, GFS2_DEFAULT_BSIZE, tfs->sb_start);
+ if (n<0) {
+ fprintf(stderr, _("Unable to write super block\n"));
+ return -errno;
+ }
+ return 0;
+}
+
+int change_label(struct tunegfs2 *tfs, char *fsname)
+{
+ char *sb_fsname = NULL;
+ int l = strlen(fsname), table_len = 0, fsname_len = 0;
+
+ sb_fsname = strchr(tfs->sb->sb_locktable, ':');
+ if (sb_fsname) {
+ table_len = sb_fsname - tfs->sb->sb_locktable;
+ fsname_len = GFS2_LOCKNAME_LEN - table_len - 1;
+ sb_fsname++;
+ }
+ if (fsname_len < l) {
+ fprintf(stderr, _("Label too long\n"));
+ return -E2BIG;
+ }
+ memset(sb_fsname, '\0', fsname_len);
+ memcpy(sb_fsname, fsname, l);
+ return 0;
+}
+
+int change_uuid(struct tunegfs2 *tfs, char *str)
+{
+ char uuid[16];
+ int status = 0;
+ if (be32_to_cpu(tfs->sb->sb_header.mh_magic) != GFS2_MAGIC) {
+ fprintf(stderr, _("UUID can be changed for a GFS2"));
+ fprintf(stderr, _(" device only\n"));
+ return -EINVAL;
+ }
+ status = str2uuid(str, uuid);
+ if (!status) {
+ memset(tfs->sb->sb_uuid , '\0', 16);
+ strncpy((char *)tfs->sb->sb_uuid, uuid, 16);
+ }
+ return status;
+}
+
+
+int change_lockproto(struct tunegfs2 *tfs, char *lockproto)
+{
+ int l = strlen(lockproto);
+ if (strncmp(lockproto, "lock_dlm", 8)
+ && strncmp(lockproto, "lock_nolock", 11)) {
+ fprintf(stderr, _("Incorrect lockproto specified\n"));
+ return -EINVAL;
+ }
+ memset(tfs->sb->sb_lockproto, '\0', GFS2_LOCKNAME_LEN);
+ strncpy(tfs->sb->sb_lockproto, lockproto, l);
+ return 0;
+}
+
+int change_locktable(struct tunegfs2 *tfs, char *locktable)
+{
+ char *sb_fsname = NULL;
+ char t_fsname[GFS2_LOCKNAME_LEN];
+ int l = strlen(locktable), table_len = 0, fsname_len = 0;
+
+ sb_fsname = strchr(tfs->sb->sb_locktable, ':');
+ if (sb_fsname) {
+ table_len = sb_fsname - tfs->sb->sb_locktable;
+ fsname_len = GFS2_LOCKNAME_LEN - table_len - 1;
+ sb_fsname++;
+ }
+ /* Gotta check if the existing fsname will allow us to fit in
+ * the new locktable name */
+ fsname_len = strlen(sb_fsname);
+ if (fsname_len > GFS2_LOCKNAME_LEN - table_len - 1)
+ fsname_len = GFS2_LOCKNAME_LEN - table_len - 1;
+
+ if (l > GFS2_LOCKNAME_LEN - fsname_len - 1) {
+ fprintf(stderr, _("Lock table name too big\n"));
+ return -E2BIG;
+ }
+ memset(t_fsname, '\0', GFS2_LOCKNAME_LEN);
+ strncpy(t_fsname, sb_fsname, fsname_len);
+ memset(tfs->sb->sb_locktable, '\0', GFS2_LOCKNAME_LEN);
+ sprintf(tfs->sb->sb_locktable, "%s:%s", locktable, t_fsname);
+ return 0;
+}
+
13 years, 9 months
gfs2-utils: master - [PATCH 1/3] tunegfs2: Initial framework
by goldwyn
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 5158b880e285481c378d82136eeff30ec5215750
Parent: aa6b5156a0d16ae78fcc49ba89e94094cf144a2f
Author: Goldwyn Rodrigues <rgoldwyn(a)gmail.com>
AuthorDate: Fri Aug 6 21:21:26 2010 -0500
Committer: Goldwyn Rodrigues <rgoldwyn(a)gmail.com>
CommitterDate: Fri Aug 6 21:21:26 2010 -0500
[PATCH 1/3] tunegfs2: Initial framework
tunegfs2 is a tool to tune parameters of the filesystem. It is capable
of modifying the uuid, label, lockproto and the locktable.
---
gfs2/tune/main.c | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++
gfs2/tune/tunegfs2.h | 34 +++++++++++
2 files changed, 189 insertions(+), 0 deletions(-)
diff --git a/gfs2/tune/main.c b/gfs2/tune/main.c
new file mode 100644
index 0000000..aa7bf45
--- /dev/null
+++ b/gfs2/tune/main.c
@@ -0,0 +1,155 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <libgen.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+
+#include <libintl.h>
+#define _(String) gettext(String)
+//#include <libgfs2.h>
+//
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include "tunegfs2.h"
+
+struct tunegfs2 tunegfs2_struct;
+struct tunegfs2 *tfs = &tunegfs2_struct;
+
+
+void parse_mount_options(char *arg)
+{
+ struct opt_map *m;
+ char *s, *c;
+ int l;
+ struct opt_map {
+ char *tag;
+ int *flag;
+ char **val;
+ } map[]= {
+ { "lockproto=", &tfs->opt_proto, &tfs->proto },
+ { "locktable=", &tfs->opt_table, &tfs->table },
+ { NULL, 0, NULL }
+ };
+
+ s = arg;
+ for (m = &map[0]; m->tag; m++) {
+ l = strlen(m->tag);
+ if (!strncmp(s, m->tag, l)) {
+ *(m->flag) = 1;
+ *(m->val) = s + l;
+ c = strchr(*(m->val), ',');
+ if (!c)
+ break;
+ *c='\0';
+ s = c+1;
+ }
+ }
+}
+
+static void usage(char *name)
+{
+ printf("Usage: %s -L <volume label> -U <UUID> -l -o "
+ "<mount options> <device> \n", basename(name));
+}
+
+static void version(void)
+{
+ printf( _("GFS2 tunefs (built %s %s)\n"),
+ __DATE__, __TIME__);
+}
+
+
+int main(int argc, char **argv)
+{
+ int c, status = 0;
+
+ memset(tfs, 0, sizeof(struct tunegfs2));
+ while((c = getopt(argc, argv, "hL:U:lo:V")) != -1) {
+ switch(c) {
+ case 'h':
+ usage(argv[0]);
+ break;
+ case 'L':
+ tfs->opt_label = 1;
+ tfs->label = optarg;
+ break;
+ case 'U':
+ tfs->opt_uuid = 1;
+ tfs->uuid = optarg;
+ break;
+ case 'l':
+ tfs->opt_list = 1;
+ break;
+ case 'o':
+ parse_mount_options(optarg);
+ break;
+ case 'V':
+ version();
+ break;
+ default:
+ fprintf(stderr, _("Invalid option.\n"));
+ usage(argv[0]);
+ status = -EINVAL;
+ goto out;
+ }
+ }
+
+ tfs->devicename = argv[optind];
+ tfs->fd = open(tfs->devicename, O_RDWR);
+
+ if (tfs->fd < 0) {
+ fprintf(stderr, _("Unable to open device %s\n"),
+ tfs->devicename);
+ status = -EIO;
+ goto out;
+ }
+
+ status = read_super(tfs);
+ if (status)
+ goto out;
+
+ if (tfs->opt_uuid) {
+ status = change_uuid(tfs, tfs->uuid);
+ if (status)
+ goto out;
+ }
+
+ /* Keep label and table together because they are the same field
+ * in the superblock */
+
+ if (tfs->opt_label) {
+ status = change_label(tfs, tfs->label);
+ if (status)
+ goto out;
+ }
+
+ if (tfs->opt_table) {
+ status = change_locktable(tfs, tfs->table);
+ if (status)
+ goto out;
+ }
+
+ if (tfs->opt_proto) {
+ status = change_lockproto(tfs, tfs->proto);
+ if (status)
+ goto out;
+ }
+
+ if (tfs->opt_label || tfs->opt_uuid ||
+ tfs->opt_table || tfs->opt_proto) {
+ status = write_super(tfs);
+ if (status)
+ goto out;
+ }
+
+ if (tfs->opt_list)
+ print_super(tfs);
+
+ close(tfs->fd);
+out:
+ return status;
+}
diff --git a/gfs2/tune/tunegfs2.h b/gfs2/tune/tunegfs2.h
new file mode 100644
index 0000000..e42de24
--- /dev/null
+++ b/gfs2/tune/tunegfs2.h
@@ -0,0 +1,34 @@
+
+#ifndef __GFS2_TUNE_DOT_H__
+#define __GFS2_TUNE_DOT_H__
+
+#define GFS2_DEFAULT_BSIZE 4096
+#define GFS_MAGIC (0x01161970) /* GFS1 magic, because we are */
+ /* not including any GFS1 headers */
+struct tunegfs2 {
+ char *devicename;
+ int fd;
+ unsigned long sb_start;
+ struct gfs2_sb *sb;
+ char *uuid;
+ char *label;
+ char *table;
+ char *proto;
+ char *mount_options;
+ int opt_list;
+ int opt_label;
+ int opt_uuid;
+ int opt_proto;
+ int opt_table;
+};
+
+int print_super(struct tunegfs2 *);
+int read_super(struct tunegfs2 *);
+int write_super(struct tunegfs2 *);
+int change_uuid(struct tunegfs2 *, char *uuid);
+int change_label(struct tunegfs2 *, char *label);
+int change_lockproto(struct tunegfs2 *, char *label);
+int change_locktable(struct tunegfs2 *, char *label);
+
+#endif
+
13 years, 9 months
cluster: RHEL56 - rgmanager: Fix clustat return code
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 801c034863c137ad3dbf3f057057b12f61a79df5
Parent: 2813311e01fce84251fd9b3f313a9af1b3bc2092
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Thu Aug 5 14:58:18 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Fri Aug 6 10:27:38 2010 -0400
rgmanager: Fix clustat return code
If rgmanager was not running, clustat would return -1 (255)
Resolves: rhbz#620730
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/utils/clustat.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/rgmanager/src/utils/clustat.c b/rgmanager/src/utils/clustat.c
index 4b9ebc9..2f58d5a 100644
--- a/rgmanager/src/utils/clustat.c
+++ b/rgmanager/src/utils/clustat.c
@@ -884,7 +884,7 @@ txt_cluster_status(cman_cluster_t *ci,
rg_state_list_t *rgs, char *name, char *svcname,
int flags)
{
- int ret;
+ int ret1 = 0, ret2 = 0;
if (!svcname && !name) {
txt_cluster_info(ci);
@@ -896,14 +896,18 @@ txt_cluster_status(cman_cluster_t *ci,
}
}
- if (!svcname || (name && svcname))
- ret = txt_member_states(membership, name);
- if (name && !svcname)
- return ret;
- if (!name || (name && svcname))
- ret = txt_rg_states(rgs, membership, svcname, flags);
-
- return ret;
+ if (!svcname || (name && svcname))
+ ret1 = txt_member_states(membership, name);
+
+ if (rgs &&
+ (!name || (name && svcname)))
+ ret2 = txt_rg_states(rgs, membership, svcname, flags);
+
+ if (name && ret1)
+ return ret1;
+ if (svcname && ret2)
+ return ret2;
+ return 0;
}
13 years, 9 months
cluster: RHEL56 - group_tool: list more than 64 groups
by David Teigland
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 2813311e01fce84251fd9b3f313a9af1b3bc2092
Parent: e8c551339350df530a99bd6006246b13b0521f12
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Feb 3 14:30:22 2010 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 5 16:25:06 2010 -0500
group_tool: list more than 64 groups
if hardcoded limit of 64 fills up, then call get_groups
again with 1024 limit.
bz 561509
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/tool/main.c | 38 ++++++++++++++++++++++++++++++++------
1 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/group/tool/main.c b/group/tool/main.c
index a6b4542..2732a46 100644
--- a/group/tool/main.c
+++ b/group/tool/main.c
@@ -269,9 +269,13 @@ static int member_compare(const void *va, const void *vb)
return *a - *b;
}
+#define BIG_GROUPS 1024
+
int do_ls(int argc, char **argv)
{
- group_data_t data[MAX_GROUPS];
+ group_data_t data_max[MAX_GROUPS];
+ group_data_t *data_big = NULL;
+ group_data_t *data;
int i, j, rv, count = 0, level, ret = 0;
char *name, *state_header;
int type_width = 16;
@@ -287,8 +291,9 @@ int do_ls(int argc, char **argv)
level = atoi(argv[opt_ind++]);
name = argv[opt_ind];
- rv = group_get_group(level, name, data);
+ rv = group_get_group(level, name, data_max);
count = 1;
+ data = data_max;
/* don't output if there's no group at all */
if (data[0].id == 0 && !strlen(data[0].name) &&
@@ -302,9 +307,27 @@ int do_ls(int argc, char **argv)
the caller */
if (data[0].member != 1)
ret = 1;
- } else
- rv = group_get_groups(MAX_GROUPS, &count, data);
+ } else {
+ data = data_max;
+ count = 0;
+
+ rv = group_get_groups(MAX_GROUPS, &count, data_max);
+ if (count < MAX_GROUPS)
+ goto report;
+
+ data_big = malloc(BIG_GROUPS * sizeof(group_data_t));
+ if (!data_big) {
+ fprintf(stderr, "cannot report all groups");
+ goto report;
+ }
+ memset(data_big, 0, BIG_GROUPS * sizeof(group_data_t));
+ count = 0;
+ data = data_big;
+ rv = group_get_groups(BIG_GROUPS, &count, data_big);
+ }
+
+ report:
if (rv < 0) {
fprintf(stderr,"Unable to connect to groupd. Is it running?\n");
return rv;
@@ -328,7 +351,7 @@ int do_ls(int argc, char **argv)
id_width, "id",
state_width, state_header);
- qsort(&data, count, sizeof(group_data_t), data_compare);
+ qsort(data, count, sizeof(group_data_t), data_compare);
for (i = 0; i < count; i++) {
@@ -339,7 +362,7 @@ int do_ls(int argc, char **argv)
id_width, data[i].id,
state_width, state_str(&data[i]));
- qsort(&data[i].members, data[i].member_count,
+ qsort(data[i].members, data[i].member_count,
sizeof(int), member_compare);
printf("[");
@@ -350,6 +373,9 @@ int do_ls(int argc, char **argv)
}
printf("]\n");
}
+
+ if (data_big)
+ free(data_big);
return ret;
}
13 years, 9 months
cluster: RHEL56 - gfs_controld: set last_plock_time for ownership operations
by David Teigland
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: e8c551339350df530a99bd6006246b13b0521f12
Parent: c5c968af388618038ca132cd0dbb01b66f1533b5
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Mar 31 16:07:05 2010 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 5 16:16:28 2010 -0500
gfs_controld: set last_plock_time for ownership operations
last_plock_time was not being set for ops related to ownership mode
like "own" and "drop" which change the plock state that is saved in
checkpoints. Not changing last_plock_time means we don't detect
that plock state has changed when it has, and may end up reusing an
old checkpoint, causing a mounting node to read incorrect resource
ownership state.
It would take a long sequence of carefully crafted steps to
intentionally hit this bug. Something like:
1. configure plock_ownership="1"
2. node1 and node2 are mounted and have plock state
3. mount gfs on node3
4. do not do any plock operations on any nodes
5. wait for one of the nodes to send a drop message
(this may require some artificial prodding)
6. mount gfs on node4
7. compare the plock state on node4 and the other nodes;
the dropped plock should exist on node4, but not on the others
8. plock operations on the dropped resource will produce errors or
inconsistent results
bz 578632
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/gfs_controld/plock.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/group/gfs_controld/plock.c b/group/gfs_controld/plock.c
index a51a1fa..1b9120d 100644
--- a/group/gfs_controld/plock.c
+++ b/group/gfs_controld/plock.c
@@ -1215,6 +1215,8 @@ static void _receive_own(struct mountgroup *mg, char *buf, int len, int from)
int should_not_happen = 0;
int rv;
+ mg->last_plock_time = time(NULL);
+
memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info));
info_bswap_in(&info);
@@ -1381,6 +1383,8 @@ static void _receive_sync(struct mountgroup *mg, char *buf, int len, int from)
struct resource *r;
int rv;
+ mg->last_plock_time = time(NULL);
+
memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info));
info_bswap_in(&info);
@@ -1426,6 +1430,8 @@ static void _receive_drop(struct mountgroup *mg, char *buf, int len, int from)
struct resource *r;
int rv;
+ mg->last_plock_time = time(NULL);
+
memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info));
info_bswap_in(&info);
13 years, 9 months