size_t len;
int ret;
+ ctdb_db = find_ctdb_db(ctdb, c->db_id);
+ if (!ctdb_db) {
+ ctdb_send_error(ctdb, hdr, -1,
+ "Unknown database in request. db_id==0x%08x",
+ c->db_id);
+ return;
+ }
+
+ if (hdr->generation != ctdb_db->generation) {
+ DEBUG(DEBUG_DEBUG,
+ ("ctdb operation %u request %u from node %u to %u had an"
+ " invalid generation:%u while our generation is:%u\n",
+ hdr->operation, hdr->reqid, hdr->srcnode, hdr->destnode,
+ hdr->generation, ctdb_db->generation));
+ return;
+ }
+
key.dptr = c->data;
key.dsize = c->keylen;
data.dptr = c->data + c->keylen;
sizeof(record_flags));
}
- ctdb_db = find_ctdb_db(ctdb, c->db_id);
- if (!ctdb_db) {
- ctdb_send_error(ctdb, hdr, -1,
- "Unknown database in request. db_id==0x%08x",
- c->db_id);
- return;
- }
-
dmaster_defer_setup(ctdb_db, hdr, key);
/* fetch the current record */
if (header.dmaster != hdr->srcnode) {
DEBUG(DEBUG_ALERT,("pnn %u dmaster request for new-dmaster %u from non-master %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u keyval=0x%08x\n",
ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
- ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
+ ctdb_db->db_id, hdr->generation, ctdb_db->generation,
(unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid,
(key.dsize >= 4)?(*(uint32_t *)key.dptr):0));
if (header.rsn != 0 || header.dmaster != ctdb->pnn) {
if (header.rsn > c->rsn) {
DEBUG(DEBUG_ALERT,("pnn %u dmaster request with older RSN new-dmaster %u from %u real-dmaster=%u key %08x dbid 0x%08x gen=%u curgen=%u c->rsn=%llu header.rsn=%llu reqid=%u\n",
ctdb->pnn, c->dmaster, hdr->srcnode, header.dmaster, ctdb_hash(&key),
- ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation,
+ ctdb_db->db_id, hdr->generation, ctdb_db->generation,
(unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid));
}
return;
}
-
ctdb_db = find_ctdb_db(ctdb, c->db_id);
if (!ctdb_db) {
ctdb_send_error(ctdb, hdr, -1,
return;
}
+ if (hdr->generation != ctdb_db->generation) {
+ DEBUG(DEBUG_DEBUG,
+ ("ctdb operation %u request %u from node %u to %u had an"
+ " invalid generation:%u while our generation is:%u\n",
+ hdr->operation, hdr->reqid, hdr->srcnode, hdr->destnode,
+ hdr->generation, ctdb_db->generation));
+ return;
+ }
+
call = talloc(hdr, struct ctdb_call);
CTDB_NO_MEMORY_FATAL(ctdb, call);
return;
}
+ if (hdr->generation != state->generation) {
+ DEBUG(DEBUG_DEBUG,
+ ("ctdb operation %u request %u from node %u to %u had an"
+ " invalid generation:%u while our generation is:%u\n",
+ hdr->operation, hdr->reqid, hdr->srcnode, hdr->destnode,
+ hdr->generation, state->generation));
+ return;
+ }
+
/* read only delegation processing */
/* If we got a FETCH_WITH_HEADER we should check if this is a ro
DEBUG(DEBUG_ERR,("Unknown db_id 0x%x in ctdb_reply_dmaster\n", c->db_id));
return;
}
-
+
+ if (hdr->generation != ctdb_db->generation) {
+ DEBUG(DEBUG_DEBUG,
+ ("ctdb operation %u request %u from node %u to %u had an"
+ " invalid generation:%u while our generation is:%u\n",
+ hdr->operation, hdr->reqid, hdr->srcnode, hdr->destnode,
+ hdr->generation, ctdb_db->generation));
+ return;
+ }
+
key.dptr = c->data;
key.dsize = c->keylen;
data.dptr = &c->data[key.dsize];
goto done;
}
- /* 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(DEBUG_DEBUG,(__location__ " ctdb operation %u"
- " request %u"
- " length %u from node %u to %u had an"
- " invalid generation id:%u while our"
- " generation id is:%u\n",
- hdr->operation, hdr->reqid,
- hdr->length,
- hdr->srcnode, hdr->destnode,
- hdr->generation, ctdb->vnn_map->generation));
- goto done;
- }
+ /* Push the check for generation in the handlers for these
+ * operations. Check database generation instead of global
+ * generation. Since the database context is not available
+ * here, push the check in the operations.
+ */
}
switch (hdr->operation) {