Rev 288: simplify the generation checking on incoming call packets in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Sat May 12 09:54:41 GMT 2007


------------------------------------------------------------
revno: 288
revision-id: tridge at samba.org-20070512095440-atc4dhk3kbgv6cxu
parent: tridge at samba.org-20070512080850-g6h43oqsh8ngm5np
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Sat 2007-05-12 19:54:40 +1000
message:
  simplify the generation checking on incoming call packets
modified:
  common/ctdb.c                  ctdb.c-20061127094323-t50f58d65iaao5of-2
=== modified file 'common/ctdb.c'
--- a/common/ctdb.c	2007-05-09 22:13:19 +0000
+++ b/common/ctdb.c	2007-05-12 09:54:40 +0000
@@ -261,8 +261,12 @@
 
 	switch (hdr->operation) {
 	case CTDB_REQ_CALL:
-		/* verify that the remote node that sent us the call
-		   is running in the same generation instance as this node
+	case CTDB_REPLY_CALL:
+	case CTDB_REQ_DMASTER:
+	case CTDB_REPLY_DMASTER:
+		/* for ctdb_call inter-node operations verify that the
+		   remote node that sent us the call is running in the
+		   same generation instance as this node
 		*/
 		if (ctdb->vnn_map->generation != hdr->generation) {
 			DEBUG(0,(__location__ " ctdb request %d"
@@ -273,20 +277,12 @@
 				hdr->srcnode, hdr->destnode, 
 				ctdb->vnn_map->generation, 
 				hdr->generation));
-			break;
-		}
-		/* if we are in recovery mode we discard all traffic
-		   until the cluster has recovered.
-		*/
-		if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
-			DEBUG(0,(__location__ " ctdb request %d"
-				" length %d from node %d to %d"
-				" while we are in recovery mode\n", 
-				hdr->reqid, hdr->length, 
-				 hdr->srcnode, hdr->destnode));
-			break;
-		}
+			goto done;
+		}
+	}
 
+	switch (hdr->operation) {
+	case CTDB_REQ_CALL:
 		ctdb->status.node.req_call++;
 		ctdb_request_call(ctdb, hdr);
 		break;
@@ -302,63 +298,11 @@
 		break;
 
 	case CTDB_REQ_DMASTER:
-		/* verify that the remote node that sent us dmaster req
-		   is running in the same generation instance as this node
-		*/
-		if (ctdb->vnn_map->generation != hdr->generation) {
-			DEBUG(0,(__location__ " ctdb dmaster request %d"
-				" length %d from node %d to %d had an"
-				" invalid generation id:%d while our"
-				" generation id is:%d\n", 
-				hdr->reqid, hdr->length, 
-				hdr->srcnode, hdr->destnode, 
-				ctdb->vnn_map->generation, 
-				hdr->generation));
-			break;
-		}
-		/* if we are in recovery mode we discard all traffic
-		   until the cluster has recovered.
-		*/
-		if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
-			DEBUG(0,(__location__ " ctdb dmaster request %d"
-				" length %d from node %d to %d"
-				" while we are in recovery mode\n", 
-				hdr->reqid, hdr->length, 
-				 hdr->srcnode, hdr->destnode));
-			break;
-		}
-
 		ctdb->status.node.req_dmaster++;
 		ctdb_request_dmaster(ctdb, hdr);
 		break;
 
 	case CTDB_REPLY_DMASTER:
-		/* verify that the remote node that sent us dmaster reply
-		   is running in the same generation instance as this node
-		*/
-		if (ctdb->vnn_map->generation != hdr->generation) {
-			DEBUG(0,(__location__ " ctdb dmaster reply %d"
-				" length %d from node %d to %d had an"
-				" invalid generation id:%d while our"
-				" generation id is:%d\n", 
-				hdr->reqid, hdr->length, 
-				hdr->srcnode, hdr->destnode, 
-				ctdb->vnn_map->generation, 
-				hdr->generation));
-			break;
-		}
-		/* if we are in recovery mode we discard all traffic
-		   until the cluster has recovered.
-		*/
-		if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
-			DEBUG(0,(__location__ " ctdb dmaster reply %d "
-				" length %d from node %d to %d"
-				" while we are in recovery mode\n", 
-				hdr->reqid, hdr->length, 
-				 hdr->srcnode, hdr->destnode));
-			break;
-		}
-
 		ctdb->status.node.reply_dmaster++;
 		ctdb_reply_dmaster(ctdb, hdr);
 		break;



More information about the samba-cvs mailing list