cluster/group/gfs_controld cpg.c lock_dlm.h ma ...
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: teigland at sourceware.org 2007-12-05 22:11:32
Modified files:
group/gfs_controld: cpg.c lock_dlm.h main.c plock.c recover.c
Log message:
bz 359271
A performance optimization for plocks. This speeds up locks that are repeatedly accessed by processes on a single node. Plocks used by processes on multiple nodes work the same way as before. The optimization is disabled by default, and can be enabled by setting
<gfs_controld plock_ownership="1"/>
in cluster.conf, or by starting gfs_controld with "-o1". It is disabled by default because enabling it breaks compatibility with previous versions of gfs_controld. If all nodes in the cluster are running this version, then plock_ownership can be enabled.
The plock_ownership mode needs extensive testing. This also introduces some minor changes when plock_ownership is disabled, so new testing is also required in that mode. Abhi and I worked on this together.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/cpg.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.9.2.3&r2=1.9.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.9&r2=1.21.2.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.13&r2=1.18.2.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/plock.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.25.2.7&r2=1.25.2.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/recover.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.23.2.10&r2=1.23.2.11
group/gfs_controld/cpg.c +45 -7
@@ -1,7 +1,7 @@/****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2006 Red Hat, Inc. All rights reserved. +** Copyright (C) 2006-2007 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions
@@ -13,6 +13,8 @@#include <openais/cpg.h> #include "lock_dlm.h" +extern struct list_head mounts; +extern unsigned int protocol_active[3 ];static cpg_handle_t daemon_handle;static struct cpg_name daemon_name;int message_flow_control_on;
@@ -21,6 +23,9 @@void receive_options (struct mountgroup *mg,char *buf,int len,int from);void receive_remount (struct mountgroup *mg,char *buf,int len,int from);void receive_plock (struct mountgroup *mg,char *buf,int len,int from); +void receive_own (struct mountgroup *mg,char *buf,int len,int from); +void receive_drop (struct mountgroup *mg,char *buf,int len,int from); +void receive_sync (struct mountgroup *mg,char *buf,int len,int from);void receive_withdraw (struct mountgroup *mg,char *buf,int len,int from);void receive_mount_status (struct mountgroup *mg,char *buf,int len,int from); void receive_recovery_status(struct mountgroup *mg, char *buf, int len,
@@ -51,9 +56,14 @@ hd->nodeid =le32_to_cpu (hd->nodeid); hd->to_nodeid =le32_to_cpu (hd->to_nodeid); -if (hd->version[0 ] !=GDLM_VER_MAJOR ) { -log_error ("reject message version %u.%u.%u" , - hd->version[0 ], hd->version[1 ], hd->version[2 ]); +/* FIXME: we need to look at how to gracefully fail when we end up +with mixed incompat versions */ + +if (hd->version[0 ] != protocol_active[0 ]) { +log_error ("reject message from %d version %u.%u.%u vs %u.%u.%u" , + nodeid, hd->version[0 ], hd->version[1 ], + hd->version[2 ], protocol_active[0 ], + protocol_active[1 ], protocol_active[2 ]);return ; }
@@ -100,6 +110,19 @@receive_withdraw (mg, data, len, nodeid);break ; +case MSG_PLOCK_OWN : +receive_own (mg, data, len, nodeid); +break ; + +case MSG_PLOCK_DROP : +receive_drop (mg, data, len, nodeid); +break ; + +case MSG_PLOCK_SYNC_LOCK : +case MSG_PLOCK_SYNC_WAITER : +receive_sync (mg, data, len, nodeid); +break ; +default :log_error ("unknown message type %d from %d" , hd->type, hd->nodeid);
@@ -112,11 +135,26 @@do_deliver (nodeid, data, data_len); } +/* Not sure if purging plocks (driven by confchg) needs to be synchronized with +the other recovery steps (driven by libgroup) for a node, don't think so. +Is it possible for a node to have been cleared from the members_gone list +before this confchg is processed? */ +void confchg_cb (cpg_handle_t handle,struct cpg_name *group_name,struct cpg_address *member_list,int member_list_entries,struct cpg_address *left_list,int left_list_entries,struct cpg_address *joined_list,int joined_list_entries) { +struct mountgroup *mg; +int i, nodeid; + +for (i =0 ; i < left_list_entries; i++) { + nodeid = left_list[i].nodeid; +list_for_each_entry (mg, &mounts, list) { +if (is_member (mg, nodeid) ||is_removed (mg, nodeid)) +purge_plocks (mg, left_list[i].nodeid,0 ); + } + } }static cpg_callbacks_t callbacks = {
@@ -238,9 +276,9 @@struct gdlm_header *hd = (struct gdlm_header *) buf;int type = hd->type; - hd->version[0 ] =cpu_to_le16 (GDLM_VER_MAJOR ); - hd->version[1 ] =cpu_to_le16 (GDLM_VER_MINOR ); - hd->version[2 ] =cpu_to_le16 (GDLM_VER_PATCH ); + hd->version[0 ] =cpu_to_le16 (protocol_active[0 ]); + hd->version[1 ] =cpu_to_le16 (protocol_active[1 ]); + hd->version[2 ] =cpu_to_le16 (protocol_active[2 ]); hd->type =cpu_to_le16 (hd->type); hd->nodeid =cpu_to_le32 (hd->nodeid); hd->to_nodeid =cpu_to_le32 (hd->to_nodeid);
group/gfs_controld/lock_dlm.h +9 -5
@@ -1,7 +1,7 @@/****************************************************************************** ******************************************************************************* ** -** Copyright (C) 2005 Red Hat, Inc. All rights reserved. +** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved. ** ** This copyrighted material is made available to anyone wishing to use, ** modify, copy, or redistribute it subject to the terms and conditions
@@ -168,6 +168,7 @@uint64_t cp_handle;time_t last_checkpoint_time;time_t last_plock_time; +struct timeval drop_resources_last;int needs_recovery;int our_jid;
@@ -241,12 +242,12 @@ MSG_MOUNT_STATUS,MSG_RECOVERY_STATUS ,MSG_RECOVERY_DONE , +MSG_PLOCK_OWN , +MSG_PLOCK_DROP , +MSG_PLOCK_SYNC_LOCK , + MSG_PLOCK_SYNC_WAITER, }; -#define GDLM_VER_MAJOR 1 -#define GDLM_VER_MINOR 0 -#define GDLM_VER_PATCH 0 -struct gdlm_header {uint16_t version[3 ];uint16_t type;/* MSG_ */
@@ -267,6 +268,9 @@int do_write (int fd,void *buf,size_t count);struct mountgroup *find_mg (char *name);struct mountgroup *find_mg_id (uint32_t id); +struct mg_member *find_memb_nodeid (struct mountgroup *mg,int nodeid); +int is_member (struct mountgroup *mg,int nodeid); +int is_removed (struct mountgroup *mg,int nodeid);int setup_cman (void );int process_cman (void );
group/gfs_controld/main.c +194 -17
282 lines not on this page · raw message
group/gfs_controld/plock.c +909 -232
1,384 lines not on this page · raw message
group/gfs_controld/recover.c +2 -4
@@ -19,7 +19,7 @@extern char *clustername;extern int our_nodeid;extern group_handle_t gh; -extern int no_withdraw; +extern int config_no_withdraw;extern int dmsetup_wait;struct list_head mounts;
@@ -1328,8 +1328,6 @@ memb->spectator, memb->wait_gfs_recover_done); -purge_plocks (mg, memb->nodeid,0 ); -if (mg->master_nodeid == memb->nodeid && memb->gone_type ==GROUP_NODE_FAILED ) master_failed =1 ;
@@ -2712,7 +2710,7 @@char *name =strstr (table,":" ) +1 ;int rv; -if (no_withdraw) { +if (config_no_withdraw) {log_error ("withdraw feature not enabled" );return 0 ; }