]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
discard REQ/REPLY DMASTER when generation id is wrong or when in
authorRonnie Sahlberg <sahlberg@ronnie>
Wed, 2 May 2007 03:31:42 +0000 (13:31 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Wed, 2 May 2007 03:31:42 +0000 (13:31 +1000)
recovery mode

(This used to be ctdb commit bfd6d430f22e38cff1d64510dc447cfbe1dab35f)

ctdb/common/ctdb.c

index 80e36491d4e9856fd8532d5c86a5c27a0fa79bdd..1d2ff27239df1b5653fb1e4c000f44e8eb98a3fc 100644 (file)
@@ -245,11 +245,11 @@ void ctdb_recv_pkt(struct ctdb_context *ctdb, uint8_t *data, uint32_t length)
                   is running in the same generation instance as this node
                */
                if (ctdb->vnn_map->generation != hdr->generation) {
-                       DEBUG(0,(__location__ " ctdb request %d of type"
-                               " %d length %d from node %d to %d had an"
+                       DEBUG(0,(__location__ " ctdb 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->operation, hdr->length, 
+                               hdr->reqid, hdr->length, 
                                hdr->srcnode, hdr->destnode, 
                                ctdb->vnn_map->generation, 
                                hdr->generation));
@@ -259,10 +259,10 @@ void ctdb_recv_pkt(struct ctdb_context *ctdb, uint8_t *data, uint32_t length)
                   until the cluster has recovered.
                */
                if (ctdb->recovery_mode != CTDB_RECOVERY_NORMAL) {
-                       DEBUG(0,(__location__ " ctdb request %d of type"
-                               " %d length %d from node %d to %d"
+                       DEBUG(0,(__location__ " ctdb request %d"
+                               " length %d from node %d to %d"
                                " while we are in recovery mode\n", 
-                               hdr->reqid, hdr->operation, hdr->length, 
+                               hdr->reqid, hdr->length, 
                                 hdr->srcnode, hdr->destnode));
                        break;
                }
@@ -282,11 +282,63 @@ void ctdb_recv_pkt(struct ctdb_context *ctdb, uint8_t *data, uint32_t length)
                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.count.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.count.reply_dmaster++;
                ctdb_reply_dmaster(ctdb, hdr);
                break;