Cluster Project branch, master, updated. cluster-2.99.00-10-gf0cc81b

teigland@sourceware.org teigland@sourceware.org
Wed Apr 30 17:07:00 GMT 2008


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=f0cc81be7ea17b3d53916c150bb8d4231511b2fa

The branch, master has been updated
       via  f0cc81be7ea17b3d53916c150bb8d4231511b2fa (commit)
      from  af2b1a3e3430a1e11b29a0ef6c34332c4176797e (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 f0cc81be7ea17b3d53916c150bb8d4231511b2fa
Author: David Teigland <teigland@redhat.com>
Date:   Wed Apr 30 11:59:44 2008 -0500

    libdlmcontrol: filling out code
    
    Signed-off-by: David Teigland <teigland@redhat.com>

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

Summary of changes:
 dlm/libdlmcontrol/libdlmcontrol.h |   13 +------
 dlm/libdlmcontrol/main.c          |   74 +++++++++++++++++++++++++++++++++++++
 dlm/tool/main.c                   |    2 +-
 group/dlm_controld/dlm_controld.h |    2 +-
 group/dlm_controld/main.c         |   15 ++++---
 5 files changed, 86 insertions(+), 20 deletions(-)

diff --git a/dlm/libdlmcontrol/libdlmcontrol.h b/dlm/libdlmcontrol/libdlmcontrol.h
index 69eee26..117e20e 100644
--- a/dlm/libdlmcontrol/libdlmcontrol.h
+++ b/dlm/libdlmcontrol/libdlmcontrol.h
@@ -46,24 +46,13 @@ int dlmc_lockspace_info(char *name, struct dlmc_lockspace *ls);
 int dlmc_lockspace_nodes(char *name, int type, int max, int *count,
 			 struct dlmc_node *nodes);
 
-/* returns a local unix socket connected to dlm_controld */
 int dlmc_fs_connect(void);
-
-/* closes the unix socket */
 void dlmc_fs_disconnect(int fd);
-
-/* writes to fd: REGISTER + name */
 int dlmc_fs_register(int fd, char *name);
-
-/* writes to fd: UNREGISTER + name */
 int dlmc_fs_unregister(int fd, char *name);
-
-/* writes to fd: NOTIFIED + name + nodeid */
 int dlmc_fs_notified(int fd, char *name, int nodeid);
-
-/* reads from fd: gets name, REGISTER/NOTIFIED, nodeid, result */
 int dlmc_fs_result(int fd, char *name, int *type, int *nodeid, int *result);
 
-int dlmc_deadlk_check(char *name);
+int dlmc_deadlock_check(char *name);
 
 #endif
diff --git a/dlm/libdlmcontrol/main.c b/dlm/libdlmcontrol/main.c
index f52bce2..2bd001d 100644
--- a/dlm/libdlmcontrol/main.c
+++ b/dlm/libdlmcontrol/main.c
@@ -281,3 +281,77 @@ int dlmc_lockspace_nodes(char *name, int type, int max, int *count, struct dlmc_
 	return rv;
 }
 
+int dlmc_fs_connect(void)
+{
+	return do_connect(DLMC_SOCK_PATH);
+}
+
+void dlmc_fs_disconnect(int fd)
+{
+	close(fd);
+}
+
+int dlmc_fs_register(int fd, char *name)
+{
+	struct dlmc_header h;
+
+	init_header(&h, name, DLMC_CMD_FS_REGISTER, sizeof(h));
+
+	return do_write(fd, &h, sizeof(h));
+}
+
+int dlmc_fs_unregister(int fd, char *name)
+{
+	struct dlmc_header h;
+
+	init_header(&h, name, DLMC_CMD_FS_UNREGISTER, sizeof(h));
+
+	return do_write(fd, &h, sizeof(h));
+}
+
+int dlmc_fs_notified(int fd, char *name, int nodeid)
+{
+	struct dlmc_header h;
+
+	init_header(&h, name, DLMC_CMD_FS_NOTIFIED, sizeof(h));
+	h.data = nodeid;
+
+	return do_write(fd, &h, sizeof(h));
+}
+
+int dlmc_fs_result(int fd, char *name, int *type, int *nodeid, int *result)
+{
+	struct dlmc_header h;
+	int rv;
+
+	rv = do_read(fd, &h, sizeof(h));
+	if (rv < 0)
+		goto out;
+
+	strncpy(name, h.name, DLM_LOCKSPACE_LEN);
+	*type = h.command;
+	*nodeid = h.option;
+	*result = h.data;
+ out:
+	return rv;
+}
+
+int dlmc_deadlock_check(char *name)
+{
+	struct dlmc_header h;
+	int fd, rv;
+
+	init_header(&h, name, DLMC_CMD_DEADLOCK_CHECK, sizeof(h));
+
+	fd = do_connect(DLMC_SOCK_PATH);
+	if (fd < 0) {
+		rv = fd;
+		goto out;
+	}
+
+	rv = do_write(fd, &h, sizeof(h));
+	close(fd);
+ out:
+	return rv;
+}
+
diff --git a/dlm/tool/main.c b/dlm/tool/main.c
index fcd6b35..ed1b21d 100644
--- a/dlm/tool/main.c
+++ b/dlm/tool/main.c
@@ -395,7 +395,7 @@ void do_spaces(void)
 
 static void do_deadlock_check(char *name)
 {
-	/* dlmc_deadlk_check(name); */
+	dlmc_deadlock_check(name);
 }
 
 int main(int argc, char **argv)
diff --git a/group/dlm_controld/dlm_controld.h b/group/dlm_controld/dlm_controld.h
index 8b18983..079a8bc 100644
--- a/group/dlm_controld/dlm_controld.h
+++ b/group/dlm_controld/dlm_controld.h
@@ -30,7 +30,7 @@
 #define DLMC_CMD_FS_REGISTER		6
 #define DLMC_CMD_FS_UNREGISTER		7
 #define DLMC_CMD_FS_NOTIFIED		8
-#define DLMC_CMD_DEADLK_CHECK		9
+#define DLMC_CMD_DEADLOCK_CHECK		9
 
 struct dlmc_header {
 	unsigned int magic;
diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c
index 5646df1..30c2c14 100644
--- a/group/dlm_controld/main.c
+++ b/group/dlm_controld/main.c
@@ -388,6 +388,7 @@ static void process_connection(int ci)
 	struct dlmc_header h;
 	char *extra = NULL;
 	int rv, extra_len;
+	struct lockspace *ls;
 
 	rv = do_read(client[ci].fd, &h, sizeof(h));
 	if (rv < 0) {
@@ -423,20 +424,21 @@ static void process_connection(int ci)
 
 	switch (h.command) {
 	case DLMC_CMD_FS_REGISTER:
+		/* TODO */
 		break;
 
 	case DLMC_CMD_FS_UNREGISTER:
+		/* TODO */
 		break;
 
 	case DLMC_CMD_FS_NOTIFIED:
+		/* TODO */
 		break;
 
-	case DLMC_CMD_DEADLK_CHECK:
-#if 0
-		ls = find_ls(hd.name);
+	case DLMC_CMD_DEADLOCK_CHECK:
+		ls = find_ls(h.name);
 		if (ls)
 			send_cycle_start(ls);
-#endif
 		break;
 
 	case DLMC_CMD_DUMP_DEBUG:
@@ -543,7 +545,7 @@ static void *process_queries(void *arg)
 			goto out;
 		}
 
-		pthread_mutex_lock(&query_mutex);
+		query_lock();
 
 		switch (h.command) {
 		case DLMC_CMD_DUMP_DEBUG:
@@ -564,7 +566,7 @@ static void *process_queries(void *arg)
 		default:
 			break;
 		}
-		pthread_mutex_unlock(&query_mutex);
+		query_unlock();
 
  out:
 		close(f);
@@ -697,6 +699,7 @@ static int loop(void)
 			goto out;
 		}
 
+		/* FIXME: lock/unlock around operations that take a while */
 		query_lock();
 
 		for (i = 0; i <= client_maxi; i++) {


hooks/post-receive
--
Cluster Project



More information about the Cluster-cvs mailing list