lvm2/clvmd-fix-node-hash.diff

83 lines
2.0 KiB
Diff

--- daemons/clvmd/clvmd-openais.c
+++ daemons/clvmd/clvmd-openais.c
@@ -100,13 +100,6 @@
SaNameT lock_name;
};
-struct lock_wait
-{
- pthread_cond_t cond;
- pthread_mutex_t mutex;
- int status;
-};
-
/* Set errno to something approximating the right value and return 0 or -1 */
static int ais_to_errno(SaAisErrorT err)
{
@@ -245,12 +238,15 @@
memcpy(&target_nodeid, msg, OPENAIS_CSID_LEN);
- DEBUGLOG("Got message from nodeid %d for %d. len %d\n",
- nodeid, target_nodeid, msg_len-4);
+ DEBUGLOG("%u got message from nodeid %d for %d. len %d\n",
+ our_nodeid, nodeid, target_nodeid, msg_len-4);
- if (target_nodeid == our_nodeid)
- process_message(cluster_client, (char *)msg+OPENAIS_CSID_LEN,
- msg_len-OPENAIS_CSID_LEN, (char*)&nodeid);
+ if (nodeid != our_nodeid) //Not send by myself
+ if (target_nodeid == our_nodeid || target_nodeid == 0)
+ process_message(cluster_client,
+ (char *)msg+OPENAIS_CSID_LEN,
+ msg_len-OPENAIS_CSID_LEN,
+ (char*)&nodeid);
}
static void cpg_confchg_callback(cpg_handle_t handle,
@@ -292,7 +288,44 @@
ninfo->state = NODE_DOWN;
}
+ for (i=0; i<member_list_entries; i++) {
+ if (member_list[i].nodeid == 0) continue;
+ ninfo = dm_hash_lookup_binary(node_hash,
+ (char *)&member_list[i].nodeid,
+ OPENAIS_CSID_LEN);
+ if (!ninfo) {
+ ninfo = malloc(sizeof(struct node_info));
+ if (!ninfo) {
+ break;
+ }
+ else {
+ ninfo->nodeid = member_list[i].nodeid;
+ dm_hash_insert_binary(node_hash,
+ (char *)&ninfo->nodeid,
+ OPENAIS_CSID_LEN, ninfo);
+ }
+ }
+ ninfo->state = NODE_CLVMD;
+ }
+
num_nodes = joined_list_entries;
+
+ //Verbose on node_hash, helpful to debug
+ struct dm_hash_node *hn;
+ DEBUGLOG("Iterate node_hash\n");
+ dm_hash_iterate(hn, node_hash)
+ {
+ ninfo = dm_hash_get_data(node_hash, hn);
+ if (ninfo->state == NODE_CLVMD) {
+ DEBUGLOG("%u:%s\n", ninfo->nodeid, "CLVMD");
+ }
+ else {
+ if (ninfo->state == NODE_DOWN)
+ DEBUGLOG("%u:%s\n", ninfo->nodeid, "DOWN");
+ }
+ }
+ DEBUGLOG("Iterate node_hash done\n");
+
}