Cluster Project branch, master, updated. cluster-2.99.00-12-g41f2735
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".
The branch, master has been updated
via 41f2735e80acff590c08161e76ce0d25ca5e9c66 (commit)
from 4e449d4110b416a7c1da8eb2cca3e81338085db5 (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 41f2735e80acff590c08161e76ce0d25ca5e9c66
Author: David Teigland <[email protected]> Date: Thu May 1 16:02:37 2008 -0500
dlm_controld: filling out code
Filling in various unfinished bits, fixing up wrong/inconsistent header length (also in fenced).
-----------------------------------------------------------------------
Summary of changes:
dlm/libdlmcontrol/main.c | 28 +++--- fence/fenced/main.c | 46 +++++--- fence/libfenced/main.c | 19 ++-- group/dlm_controld/cpg.c | 41 +++++++- group/dlm_controld/dlm_daemon.h | 18 +++- group/dlm_controld/group.c | 17 +++ group/dlm_controld/main.c | 227 ++++++++++++++++++++++++++++++++++---- group/dlm_controld/plock.c | 35 ++++--- 8 files changed, 346 insertions(+), 85 deletions(-)
dlm/libdlmcontrol/main.c +15 -13
@@ -84,27 +84,28 @@ static int do_connect(char *sock_path)return fd; } -static void init_header (struct dlmc_header *h,char *name,int cmd,int len) +static void init_header (struct dlmc_header *h,int cmd,char *name, +int extra_len) {memset (h,0 ,sizeof (struct dlmc_header )); h->magic =DLMC_MAGIC ; h->version =DLMC_VERSION ; - h->len = len; + h->len =sizeof (struct dlmc_header ) + extra_len; h->command = cmd;if (name) -strncpy (h->name, name,DLM_LOCKSPACE_LEN );/* no term null in header */ +strncpy (h->name, name,DLM_LOCKSPACE_LEN ); } -int do_dump (int type,char *name,char *buf) +int do_dump (int cmd,char *name,char *buf) {struct dlmc_header h, *rh;char *reply;int reply_len;int fd, rv; -init_header (&h, name, type,sizeof (h)); +init_header (&h, cmd, name,0 ); reply_len =sizeof (struct dlmc_header ) +DLMC_DUMP_SIZE ; reply =malloc (reply_len);
@@ -156,7 +157,7 @@ int dlmc_node_info(char *name, int nodeid, struct dlmc_node *node)char reply[sizeof (struct dlmc_header ) +sizeof (struct dlmc_node )];int fd, rv; -init_header (&h, name,DLMC_CMD_NODE_INFO ,sizeof (h)); +init_header (&h,DLMC_CMD_NODE_INFO , name,0 ); h.data = nodeid;memset (reply,0 ,sizeof (reply));
@@ -194,7 +195,7 @@ int dlmc_lockspace_info(char *name, struct dlmc_lockspace *lockspace)char reply[sizeof (struct dlmc_header ) +sizeof (struct dlmc_lockspace )];int fd, rv; -init_header (&h, name,DLMC_CMD_LOCKSPACE_INFO ,sizeof (h)); +init_header (&h,DLMC_CMD_LOCKSPACE_INFO , name,0 );memset (reply,0 ,sizeof (reply));
@@ -225,14 +226,15 @@ int dlmc_lockspace_info(char *name, struct dlmc_lockspace *lockspace)return rv; } -int dlmc_lockspace_nodes (char *name,int type,int max,int *count,struct dlmc_node *nodes) +int dlmc_lockspace_nodes (char *name,int type,int max,int *count, +struct dlmc_node *nodes) {struct dlmc_header h, *rh;char *reply;int reply_len;int fd, rv, result, node_count; -init_header (&h, name,DLMC_CMD_LOCKSPACE_NODES ,sizeof (h)); +init_header (&h,DLMC_CMD_LOCKSPACE_NODES , name,0 ); h.option = type; h.data = max;
@@ -295,7 +297,7 @@ int dlmc_fs_register(int fd, char *name) {struct dlmc_header h; -init_header (&h, name,DLMC_CMD_FS_REGISTER ,sizeof (h)); +init_header (&h,DLMC_CMD_FS_REGISTER , name,0 );return do_write (fd, &h,sizeof (h)); }
@@ -304,7 +306,7 @@ int dlmc_fs_unregister(int fd, char *name) {struct dlmc_header h; -init_header (&h, name,DLMC_CMD_FS_UNREGISTER ,sizeof (h)); +init_header (&h,DLMC_CMD_FS_UNREGISTER , name,0 );return do_write (fd, &h,sizeof (h)); }
@@ -313,7 +315,7 @@ int dlmc_fs_notified(int fd, char *name, int nodeid) {struct dlmc_header h; -init_header (&h, name,DLMC_CMD_FS_NOTIFIED ,sizeof (h)); +init_header (&h,DLMC_CMD_FS_NOTIFIED , name,0 ); h.data = nodeid;return do_write (fd, &h,sizeof (h));
@@ -341,7 +343,7 @@ int dlmc_deadlock_check(char *name)struct dlmc_header h;int fd, rv; -init_header (&h, name,DLMC_CMD_DEADLOCK_CHECK ,sizeof (h)); +init_header (&h,DLMC_CMD_DEADLOCK_CHECK , name,0 ); fd =do_connect (DLMC_SOCK_PATH );if (fd <0 ) {
fence/fenced/main.c +28 -18
75 lines not on this page · raw message
fence/libfenced/main.c +10 -9
@@ -83,13 +83,13 @@ static int do_connect(char *sock_path)return fd; } -static void init_header (struct fenced_header *h,int cmd,int len) +static void init_header (struct fenced_header *h,int cmd,int extra_len) {memset (h,0 ,sizeof (struct fenced_header )); h->magic =FENCED_MAGIC ; h->version =FENCED_VERSION ; - h->len = len; + h->len =sizeof (struct fenced_header ) + extra_len; h->command = cmd; }
@@ -98,7 +98,7 @@ int fenced_join(void)struct fenced_header h;int fd, rv; -init_header (&h,FENCED_CMD_JOIN ,sizeof (h)); +init_header (&h,FENCED_CMD_JOIN ,0 ); fd =do_connect (FENCED_SOCK_PATH );if (fd <0 ) {
@@ -117,7 +117,7 @@ int fenced_leave(void)struct fenced_header h;int fd, rv; -init_header (&h,FENCED_CMD_LEAVE ,sizeof (h)); +init_header (&h,FENCED_CMD_LEAVE ,0 ); fd =do_connect (FENCED_SOCK_PATH );if (fd <0 ) {
@@ -139,7 +139,8 @@ int fenced_external(char *name)int namelen;memset (&msg,0 ,sizeof (msg)); -init_header (hd,FENCED_CMD_EXTERNAL ,sizeof (msg)); + +init_header (hd,FENCED_CMD_EXTERNAL ,MAX_NODENAME_LEN +1 ); namelen =strlen (name);if (namelen >MAX_NODENAME_LEN )
@@ -165,7 +166,7 @@ int fenced_dump_debug(char *buf)int reply_len;int fd, rv; -init_header (&h,FENCED_CMD_DUMP_DEBUG ,sizeof (h)); +init_header (&h,FENCED_CMD_DUMP_DEBUG ,0 ); reply_len =sizeof (struct fenced_header ) +FENCED_DUMP_SIZE ; reply =malloc (reply_len);
@@ -207,7 +208,7 @@ int fenced_node_info(int nodeid, struct fenced_node *node)char reply[sizeof (struct fenced_header ) +sizeof (struct fenced_node )];int fd, rv; -init_header (&h,FENCED_CMD_NODE_INFO ,sizeof (h)); +init_header (&h,FENCED_CMD_NODE_INFO ,0 ); h.data = nodeid;memset (reply,0 ,sizeof (reply));
@@ -245,7 +246,7 @@ int fenced_domain_info(struct fenced_domain *domain)char reply[sizeof (struct fenced_header ) +sizeof (struct fenced_domain )];int fd, rv; -init_header (&h,FENCED_CMD_DOMAIN_INFO ,sizeof (h)); +init_header (&h,FENCED_CMD_DOMAIN_INFO ,0 );memset (reply,0 ,sizeof (reply));
@@ -283,7 +284,7 @@ int fenced_domain_nodes(int type, int max, int *count, struct fenced_node *nodesint reply_len;int fd, rv, result, node_count; -init_header (&h,FENCED_CMD_DOMAIN_NODES ,sizeof (h)); +init_header (&h,FENCED_CMD_DOMAIN_NODES ,0 ); h.option = type; h.data = max;
group/dlm_controld/cpg.c +39 -2
56 lines not on this page · raw message
group/dlm_controld/dlm_daemon.h +15 -3
@@ -86,6 +86,8 @@ extern char daemon_debug_buf[256];extern char dump_buf[DLMC_DUMP_SIZE ];extern int dump_point;extern int dump_wrap; +extern char plock_dump_buf[DLMC_DUMP_SIZE ]; +extern int plock_dump_len;void daemon_dump_save (void );
@@ -202,7 +204,7 @@ int set_sysfs_control(char *name, int val);int set_sysfs_event_done (char *name,int val);int set_sysfs_id (char *name,uint32_t id);int set_configfs_members (char *name,int new_count,int *new_members, -int renew_count,int *renew_members); +int renew_count,int *renew_members);void clear_configfs (void );int add_configfs_node (int nodeid,char *addr,int addrlen,int local);void del_configfs_node (int nodeid);
@@ -218,12 +220,17 @@ int dlm_join_lockspace(struct lockspace *ls);int dlm_leave_lockspace (struct lockspace *ls);char *msg_name (int type);void update_flow_control_status (void ); +int set_node_info (struct lockspace *ls,int nodeid,struct dlmc_node *node); +int set_lockspace_info (struct lockspace *ls,struct dlmc_lockspace *lockspace); +int set_lockspace_nodes (struct lockspace *ls,int option,int *node_count, +struct dlmc_node **nodes); +int set_fs_notified (struct lockspace *ls,int nodeid);/* deadlock.c */ void setup_deadlock (void );void send_cycle_start (struct lockspace *ls);void receive_checkpoint_ready (struct lockspace *ls,struct dlm_header *hd, -int len); +int len);void receive_cycle_start (struct lockspace *ls,struct dlm_header *hd,int len);void receive_cycle_end (struct lockspace *ls,struct dlm_header *hd,int len);void receive_cancel_lock (struct lockspace *ls,struct dlm_header *hd,int len);
@@ -264,13 +271,18 @@ void close_plock_checkpoint(struct lockspace *ls);void store_plocks (struct lockspace *ls);void retrieve_plocks (struct lockspace *ls);void purge_plocks (struct lockspace *ls,int nodeid,int unmount); -int dump_plocks (char *name,int fd); +int fill_plock_dump_buf (struct lockspace *ls);/* group.c */ int setup_groupd (void );void process_groupd (int ci);int dlm_join_lockspace_group (struct lockspace *ls);int dlm_leave_lockspace_group (struct lockspace *ls); +int set_node_info_group (struct lockspace *ls,int nodeid,struct dlmc_node *node); +int set_lockspace_info_group (struct lockspace *ls, +struct dlmc_lockspace *lockspace); +int set_lockspace_nodes_group (struct lockspace *ls,int option,int *node_count, +struct dlmc_node **nodes);#endif
group/dlm_controld/group.c +17 -0
@@ -240,3 +240,20 @@ int setup_groupd(void)return rv; } +int set_node_info_group (struct lockspace *ls,int nodeid,struct dlmc_node *node) +{ +return 0 ; +} + +int set_lockspace_info_group (struct lockspace *ls, +struct dlmc_lockspace *lockspace) +{ +return 0 ; +} + +int set_lockspace_nodes_group (struct lockspace *ls,int option,int *node_count, +struct dlmc_node **nodes) +{ +return 0 ; +} +
group/dlm_controld/main.c +203 -24
267 lines not on this page · raw message
group/dlm_controld/plock.c +19 -16
@@ -2247,25 +2247,20 @@ void purge_plocks(struct lockspace *ls, int nodeid, int unmount)log_group (ls,"purged %d plocks for %d" , purged, nodeid); } -int dump_plocks (char *name,int fd) +int fill_plock_dump_buf (struct lockspace *ls) { -struct lockspace *ls;struct posix_lock *po;struct lock_waiter *w;struct resource *r; -char line[MAXLINE ]; -int rv; - -if (!name) -return -1 ; +int rv =0 ; +int len =DLMC_DUMP_SIZE , pos =0 , ret; - ls =find_ls (name); -if (!ls) -return -1 ; +memset (plock_dump_buf,0 ,sizeof (plock_dump_buf)); + plock_dump_len =0 ;list_for_each_entry (r, &ls->plock_resources, list) {list_for_each_entry (po, &r->locks, list) { - snprintf(line, MAXLINE, + ret = snprintf(plock_dump_buf + pos, len - pos, "%llu %s %llu-%llu nodeid %d pid %u owner %llx\n", (unsigned long long)r->number, po->ex ? "WR" : "RD",
@@ -2274,11 +2269,15 @@ int dump_plocks(char *name, int fd) po->nodeid, po->pid, (unsigned long long)po->owner); - rv =do_write (fd, line,strlen (line)); +if (ret >= len - pos) { + rv = -ENOSPC ; + goto out; + } + pos += ret; }list_for_each_entry (w, &r->waiters, list) { - snprintf(line, MAXLINE, + ret = snprintf(plock_dump_buf + pos, len - pos, "%llu WAITING %s %llu-%llu nodeid %d pid %u owner %llx\n", (unsigned long long)r->number, w->info.ex ? "WR" : "RD",
@@ -2287,11 +2286,15 @@ int dump_plocks(char *name, int fd) w->info.nodeid, w->info.pid, (unsigned long long)w->info.owner); - rv =do_write (fd, line,strlen (line)); +if (ret >= len - pos) { + rv = -ENOSPC ; + goto out; + } + pos += ret; } } - -return 0 ; + out: +return rv; }#if 0
hooks/post-receive
--
Cluster Project