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

[Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.05-55-g6fb8dc9



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=6fb8dc9d73db3a5e48589ee274f1c34ee4bc76c5

The branch, master has been updated
       via  6fb8dc9d73db3a5e48589ee274f1c34ee4bc76c5 (commit)
      from  8f1689a1cfc859aa3307ff92e06242d32f2c5f8a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6fb8dc9d73db3a5e48589ee274f1c34ee4bc76c5
Author: David Teigland <teigland redhat com>
Date:   Mon Jul 7 15:35:32 2008 -0500

    gfs_controld: support queries from gfs_control
    
    through libgfscontrol
    
    Signed-off-by: David Teigland <teigland redhat com>

-----------------------------------------------------------------------

Summary of changes:
 group/gfs_control/main.c            |  224 ++++++++++++++++++++++++++++++++++-
 group/gfs_controld/cpg-new.c        |   93 ++++++++-------
 group/libgfscontrol/libgfscontrol.h |   24 +++-
 3 files changed, 291 insertions(+), 50 deletions(-)

diff --git a/group/gfs_control/main.c b/group/gfs_control/main.c
index 9d2e1ef..265713a 100644
--- a/group/gfs_control/main.c
+++ b/group/gfs_control/main.c
@@ -14,7 +14,7 @@
 
 #include "libgfscontrol.h"
 
-#define OPTION_STRING			"hV"
+#define OPTION_STRING			"vhV"
 
 #define OP_LIST				1
 #define OP_DUMP				2
@@ -27,6 +27,7 @@ static char *prog_name;
 static char *fsname;
 static int operation;
 static int opt_ind;
+static int verbose;
 
 static void print_usage(void)
 {
@@ -35,6 +36,7 @@ static void print_usage(void)
 	printf("%s [options] [ls|dump|plocks]\n", prog_name);
 	printf("\n");
 	printf("Options:\n");
+	printf("  -v               Verbose output\n");
 	printf("  -h               Print this help, then exit\n");
 	printf("  -V               Print program version information, then exit\n");
 	printf("\n");
@@ -142,12 +144,230 @@ static int do_write(int fd, void *buf, size_t count)
 	return 0;
 }
 
-void do_leave(char *name)
+void do_leave(char *table)
 {
+	struct gfsc_mount_args ma;
+	int rv;
+
+	memset(&ma, 0, sizeof(ma));
+
+	strncpy(ma.table, table, sizeof(ma.table));
+
+	rv = gfsc_fs_leave(&ma, 0);
+	if (rv < 0)
+		fprintf(stderr, "gfs_controld leave error %d\n", rv);
+}
+
+char *gfsc_mf_str(uint32_t flags)
+{
+	static char str[128];
+
+	memset(str, 0, sizeof(str));
+
+	if (flags & GFSC_MF_JOINING)
+		strcat(str, "joining ");
+	if (flags & GFSC_MF_LEAVING)
+		strcat(str, "leaving ");
+	if (flags & GFSC_MF_KERNEL_STOPPED)
+		strcat(str, "kernel_stopped ");
+	if (flags & GFSC_MF_KERNEL_MOUNT_DONE)
+		strcat(str, "kernel_mount_done ");
+	if (flags & GFSC_MF_KERNEL_MOUNT_ERROR)
+		strcat(str, "kernel_mount_error ");
+	if (flags & GFSC_MF_FIRST_RECOVERY_NEEDED)
+		strcat(str, "first_recovery_needed ");
+	if (flags & GFSC_MF_FIRST_RECOVERY_MSG)
+		strcat(str, "first_recovery_msg ");
+	if (flags & GFSC_MF_LOCAL_RECOVERY_BUSY)
+		strcat(str, "local_recovery_busy ");
+
+	return str;
+}
+
+char *gfsc_nf_str(uint32_t flags)
+{
+	static char str[128];
+
+	memset(str, 0, sizeof(str));
+
+	if (flags & GFSC_NF_MEMBER)
+		strcat(str, "member ");
+	if (flags & GFSC_NF_START)
+		strcat(str, "start ");
+	if (flags & GFSC_NF_DISALLOWED)
+		strcat(str, "disallowed ");
+	if (flags & GFSC_NF_KERNEL_MOUNT_DONE)
+		strcat(str, "kernel_mount_done ");
+	if (flags & GFSC_NF_KERNEL_MOUNT_ERROR)
+		strcat(str, "kernel_mount_error ");
+	if (flags & GFSC_NF_READONLY)
+		strcat(str, "readonly ");
+	if (flags & GFSC_NF_SPECTATOR)
+		strcat(str, "spectator ");
+	if (flags & GFSC_NF_CHECK_DLM)
+		strcat(str, "check_dlm ");
+
+	return str;
+}
+
+char *condition_str(int cond)
+{
+	switch (cond) {
+	case 0:
+		return "";
+	case 1:
+		return "kernel_mount_done";
+	case 2:
+		return "notify_nodeid";
+	case 3:
+		return "poll_dlm";
+	case 4:
+		return "pending";
+	default:
+		return "unknown";
+	}
+}
+
+static void show_mg(struct gfsc_mountgroup *mg)
+{
+	printf("gfs mountgroup \"%s\"\n", mg->name);
+	printf("id 0x%x flags 0x%x %s\n", mg->global_id, mg->flags,
+		gfsc_mf_str(mg->flags));
+	printf("journals needing recovery %d\n", mg->journals_need_recovery);
+
+	printf("seq %u-%u counts member %d joined %d remove %d failed %d\n",
+	        mg->cg_prev.combined_seq, mg->cg_prev.seq,
+		mg->cg_prev.member_count, mg->cg_prev.joined_count,
+		mg->cg_prev.remove_count, mg->cg_prev.failed_count);
+
+	if (!mg->cg_next.seq)
+		return;
+
+	printf("new seq %u-%u counts member %d joined %d remove %d failed %d\n",
+	        mg->cg_next.combined_seq, mg->cg_next.seq,
+		mg->cg_next.member_count, mg->cg_next.joined_count,
+		mg->cg_next.remove_count, mg->cg_next.failed_count);
+
+	printf("new wait_messages %d wait_condition %d %s\n",
+		mg->cg_next.wait_messages, mg->cg_next.wait_condition,
+		condition_str(mg->cg_next.wait_condition));
+}
+
+static void show_all_nodes(int count, struct gfsc_node *nodes)
+{
+	struct gfsc_node *n = nodes;
+	int i;
+
+	for (i = 0; i < count; i++) {
+		printf("nodeid %d jid %d add_seq %u rem_seq %u failed %d flags 0x%x %s\n",
+			n->nodeid, n->jid, n->added_seq, n->removed_seq,
+			n->failed_reason, n->flags, gfsc_nf_str(n->flags));
+		n++;
+	}
+}
+
+static void show_nodeids(int count, struct gfsc_node *nodes)
+{
+	struct gfsc_node *n = nodes;
+	int i;
+
+	for (i = 0; i < count; i++) {
+		printf("%d ", n->nodeid);
+		n++;
+	}
+	printf("\n");
 }
 
+static int node_compare(const void *va, const void *vb)
+{
+	const struct gfsc_node *a = va;
+	const struct gfsc_node *b = vb;
+
+	return a->nodeid - b->nodeid;
+}
+
+#define MAX_MG 128
+#define MAX_NODES 128
+
+struct gfsc_mountgroup mgs[MAX_MG];
+struct gfsc_node nodes[MAX_NODES];
+
 static void do_list(char *name)
 {
+	struct gfsc_mountgroup *mg;
+	int node_count;
+	int mg_count;
+	int rv;
+	int i;
+
+	memset(mgs, 0, sizeof(mgs));
+
+	if (name) {
+		rv = gfsc_mountgroup_info(name, mgs);
+		if (rv < 0)
+			goto out;
+		mg_count = 1;
+	} else {
+		rv = gfsc_mountgroups(MAX_MG, &mg_count, mgs);
+		if (rv < 0)
+			goto out;
+	}
+
+	for (i = 0; i < mg_count; i++) {
+		mg = &mgs[i];
+
+		show_mg(mg);
+
+		node_count = 0;
+		memset(&nodes, 0, sizeof(nodes));
+
+		rv = gfsc_mountgroup_nodes(mg->name, GFSC_NODES_MEMBERS,
+					   MAX_NODES, &node_count, nodes);
+		if (rv < 0)
+			goto out;
+
+		qsort(nodes, node_count, sizeof(struct gfsc_node),node_compare);
+
+		printf("members ");
+		show_nodeids(node_count, nodes);
+
+		if (!mg->cg_next.seq)
+			goto show_all;
+
+		node_count = 0;
+		memset(&nodes, 0, sizeof(nodes));
+
+		rv = gfsc_mountgroup_nodes(mg->name, GFSC_NODES_NEXT,
+					   MAX_NODES, &node_count, nodes);
+		if (rv < 0)
+			goto out;
+
+		qsort(nodes, node_count, sizeof(struct gfsc_node),node_compare);
+
+		printf("new members ");
+		show_nodeids(node_count, nodes);
+
+ show_all:
+		if (!verbose)
+			continue;
+
+		node_count = 0;
+		memset(&nodes, 0, sizeof(nodes));
+
+		rv = gfsc_mountgroup_nodes(mg->name, GFSC_NODES_ALL,
+					   MAX_NODES, &node_count, nodes);
+		if (rv < 0)
+			goto out;
+
+		qsort(nodes, node_count, sizeof(struct gfsc_node),node_compare);
+
+		printf("all nodes\n");
+		show_all_nodes(node_count, nodes);
+	}
+	return;
+ out:
+	fprintf(stderr, "gfs_controld query error %d\n", rv);
+
 }
 
 static void do_plocks(char *name)
diff --git a/group/gfs_controld/cpg-new.c b/group/gfs_controld/cpg-new.c
index d43d53b..95cc007 100644
--- a/group/gfs_controld/cpg-new.c
+++ b/group/gfs_controld/cpg-new.c
@@ -2392,38 +2392,41 @@ int setup_dlmcontrol(void)
 	return dlmcontrol_fd;
 }
 
-#if 0
-int set_mountgroup_info(struct mountgroup *mg, struct gfsc_mountgroup *mountgroup)
+int set_mountgroup_info(struct mountgroup *mg, struct gfsc_mountgroup *out)
 {
 	struct change *cg, *last = NULL;
 
-	strncpy(mountgroup->name, mg->name, GFS_LOCKSPACE_LEN);
-	mountgroup->global_id = mg->id;
+	strncpy(out->name, mg->name, GFS_MOUNTGROUP_LEN);
+	out->global_id = mg->id;
 
 	if (mg->joining)
-		mountgroup->flags |= GFSC_LF_JOINING;
+		out->flags |= GFSC_MF_JOINING;
 	if (mg->leaving)
-		mountgroup->flags |= GFSC_LF_LEAVING;
+		out->flags |= GFSC_MF_LEAVING;
 	if (mg->kernel_stopped)
-		mountgroup->flags |= GFSC_LF_KERNEL_STOPPED;
-	if (mg->fs_registered)
-		mountgroup->flags |= GFSC_LF_FS_REGISTERED;
-	if (mg->need_plocks)
-		mountgroup->flags |= GFSC_LF_NEED_PLOCKS;
-	if (mg->save_plocks)
-		mountgroup->flags |= GFSC_LF_SAVE_PLOCKS;
+		out->flags |= GFSC_MF_KERNEL_STOPPED;
+	if (mg->kernel_mount_done)
+		out->flags |= GFSC_MF_KERNEL_MOUNT_DONE;
+	if (mg->kernel_mount_error)
+		out->flags |= GFSC_MF_KERNEL_MOUNT_ERROR;
+	if (mg->first_recovery_needed)
+		out->flags |= GFSC_MF_FIRST_RECOVERY_NEEDED;
+	if (mg->first_recovery_msg)
+		out->flags |= GFSC_MF_FIRST_RECOVERY_MSG;
+	if (mg->local_recovery_busy)
+		out->flags |= GFSC_MF_LOCAL_RECOVERY_BUSY;
 
 	if (!mg->started_change)
 		goto next;
 
 	cg = mg->started_change;
 
-	mountgroup->cg_prev.member_count = cg->member_count;
-	mountgroup->cg_prev.joined_count = cg->joined_count;
-	mountgroup->cg_prev.remove_count = cg->remove_count;
-	mountgroup->cg_prev.failed_count = cg->failed_count;
-	mountgroup->cg_prev.combined_seq = cg->combined_seq;
-	mountgroup->cg_prev.seq = cg->seq;
+	out->cg_prev.member_count = cg->member_count;
+	out->cg_prev.joined_count = cg->joined_count;
+	out->cg_prev.remove_count = cg->remove_count;
+	out->cg_prev.failed_count = cg->failed_count;
+	out->cg_prev.combined_seq = cg->combined_seq;
+	out->cg_prev.seq = cg->seq;
 
  next:
 	if (list_empty(&mg->changes))
@@ -2434,24 +2437,27 @@ int set_mountgroup_info(struct mountgroup *mg, struct gfsc_mountgroup *mountgrou
 
 	cg = list_first_entry(&mg->changes, struct change, list);
 
-	mountgroup->cg_next.member_count = cg->member_count;
-	mountgroup->cg_next.joined_count = cg->joined_count;
-	mountgroup->cg_next.remove_count = cg->remove_count;
-	mountgroup->cg_next.failed_count = cg->failed_count;
-	mountgroup->cg_next.combined_seq = last->seq;
-	mountgroup->cg_next.seq = cg->seq;
+	out->cg_next.member_count = cg->member_count;
+	out->cg_next.joined_count = cg->joined_count;
+	out->cg_next.remove_count = cg->remove_count;
+	out->cg_next.failed_count = cg->failed_count;
+	out->cg_next.combined_seq = last->seq;
+	out->cg_next.seq = cg->seq;
+
+	/* FIXME: use real definitions for these conditions
+	   (also in dlm_controld) */
 
 	if (cg->state == CGST_WAIT_CONDITIONS)
-		mountgroup->cg_next.wait_condition = 4;
-	if (poll_fencing)
-		mountgroup->cg_next.wait_condition = 1;
-	else if (poll_quorum)
-		mountgroup->cg_next.wait_condition = 2;
-	else if (poll_fs)
-		mountgroup->cg_next.wait_condition = 3;
+		out->cg_next.wait_condition = 4;
+	if (!mg->kernel_mount_done)
+		out->cg_next.wait_condition = 1;
+	if (mg->dlm_notify_nodeid)
+		out->cg_next.wait_condition = 2;
+	if (poll_dlm)
+		out->cg_next.wait_condition = 3;
 
 	if (cg->state == CGST_WAIT_MESSAGES)
-		mountgroup->cg_next.wait_messages = 1;
+		out->cg_next.wait_messages = 1;
  out:
 	return 0;
 }
@@ -2481,14 +2487,18 @@ static int _set_node_info(struct mountgroup *mg, struct change *cg, int nodeid,
 	if (!n)
 		goto out;
 
-	if (n->check_fencing)
-		node->flags |= GFSC_NF_CHECK_FENCING;
-	if (n->check_quorum)
-		node->flags |= GFSC_NF_CHECK_QUORUM;
-	if (n->check_fs)
-		node->flags |= GFSC_NF_CHECK_FS;
-	if (n->fs_notified)
-		node->flags |= GFSC_NF_FS_NOTIFIED;
+	node->jid = n->jid;
+
+	if (n->kernel_mount_done)
+		node->flags |= GFSC_NF_KERNEL_MOUNT_DONE;
+	if (n->kernel_mount_error)
+		node->flags |= GFSC_NF_KERNEL_MOUNT_ERROR;
+	if (n->check_dlm)
+		node->flags |= GFSC_NF_CHECK_DLM;
+	if (n->ro)
+		node->flags |= GFSC_NF_READONLY;
+	if (n->spectator)
+		node->flags |= GFSC_NF_SPECTATOR;
 
 	node->added_seq = n->added_seq;
 	node->removed_seq = n->removed_seq;
@@ -2583,4 +2593,3 @@ int set_mountgroup_nodes(struct mountgroup *mg, int option, int *node_count,
 	*nodes_out = nodes;
 	return 0;
 }
-#endif
diff --git a/group/libgfscontrol/libgfscontrol.h b/group/libgfscontrol/libgfscontrol.h
index 028b32b..90578e5 100644
--- a/group/libgfscontrol/libgfscontrol.h
+++ b/group/libgfscontrol/libgfscontrol.h
@@ -10,12 +10,18 @@
 
 #define GFSC_DUMP_SIZE		(1024 * 1024)
 
-#define GFSC_NF_MEMBER		0x00000001 /* node is member in cg */
-#define GFSC_NF_START		0x00000002 /* start message recvd for cg */
-#define GFSC_NF_DISALLOWED	0x00000004 /* node disallowed in cg */
+#define GFSC_NF_MEMBER			0x00000001 /* node is member in cg */
+#define GFSC_NF_START			0x00000002 /* start message recvd */
+#define GFSC_NF_DISALLOWED		0x00000004 /* node disallowed in cg */
+#define GFSC_NF_KERNEL_MOUNT_DONE	0x00000008
+#define GFSC_NF_KERNEL_MOUNT_ERROR	0x00000010
+#define GFSC_NF_READONLY		0x00000010
+#define GFSC_NF_SPECTATOR		0x00000010
+#define GFSC_NF_CHECK_DLM		0x00000010
 
 struct gfsc_node {
 	int nodeid;
+	int jid;
 	uint32_t flags;
 	uint32_t added_seq;
 	uint32_t removed_seq;
@@ -33,13 +39,19 @@ struct gfsc_change {
 	uint32_t combined_seq;
 };
 
-#define GFSC_LF_JOINING		0x00000001
-#define GFSC_LF_LEAVING		0x00000002
-#define GFSC_LF_KERNEL_STOPPED	0x00000004
+#define GFSC_MF_JOINING			0x00000001
+#define GFSC_MF_LEAVING			0x00000002
+#define GFSC_MF_KERNEL_STOPPED		0x00000004
+#define GFSC_MF_KERNEL_MOUNT_DONE	0x00000004
+#define GFSC_MF_KERNEL_MOUNT_ERROR	0x00000004
+#define GFSC_MF_FIRST_RECOVERY_NEEDED	0x00000008
+#define GFSC_MF_FIRST_RECOVERY_MSG	0x00000010
+#define GFSC_MF_LOCAL_RECOVERY_BUSY	0x00000020
 
 struct gfsc_mountgroup {
 	struct gfsc_change cg_prev;	/* completed change (started_change) */
 	struct gfsc_change cg_next;	/* in-progress change (changes list) */
+	int journals_need_recovery;	/* count of jounals need_recovery */
 	uint32_t flags;
 	uint32_t global_id;
 	char name[GFS_MOUNTGROUP_LEN+1];


hooks/post-receive
--
Cluster Project


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