diff options
author | Amitay Isaacs <amitay@gmail.com> | 2016-02-02 15:58:37 +1100 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2016-02-09 12:39:24 +0100 |
commit | b71c2e42308d23f08e1dd38c9a45ee8f25c65404 (patch) | |
tree | 346fe0f357c1fd2fd0ef9a71ad343071ed4544fc /ctdb/server/ctdb_call.c | |
parent | be704c87650d85159c054b03fc94e2eee1eab17e (diff) | |
download | samba-b71c2e42308d23f08e1dd38c9a45ee8f25c65404.tar.gz |
Revert "ctdb-daemon: Check packet generation against database generation"
This reverts commit 0ff90f4fac74e61192aff100b168e38ce0adfabb.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11707
The checks against database generation are not required since
the global generation is updated as part of updating vnnmap
before the actual database recovery. This change was done in
5aab31a39a3589b910a78b96071d6aa5e6547696.
Checking only against the database generation is incomplete. It can
cause CTDB to abort if the following sequence of events happen.
- CTDB gets REQ_DMASTER packet (gen1)
This packet processing gets deferred to get a record lock
- CTDB goes into recovery, marks RECOVERY_ACTIVE
CTDB recovery helper updates vnnmap (gen2)
- CTDB processes REQ_DMASTER packet (gen1)
The check against database generation (gen1) succeeds.
The check for lmaster is now invalid because VNNMAP has changed.
This will cause CTDB to abort due to protocol error.
Reverting the patch stops processing packets of older generation before
they get into call processing.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Tue Feb 9 12:39:24 CET 2016 on sn-devel-144
Diffstat (limited to 'ctdb/server/ctdb_call.c')
-rw-r--r-- | ctdb/server/ctdb_call.c | 59 |
1 files changed, 12 insertions, 47 deletions
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c index 453b4561d54..2461f959fb9 100644 --- a/ctdb/server/ctdb_call.c +++ b/ctdb/server/ctdb_call.c @@ -586,23 +586,6 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr 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; @@ -614,6 +597,14 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr 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 */ @@ -642,7 +633,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr 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_db->generation, + ctdb_db->db_id, hdr->generation, ctdb->vnn_map->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) { @@ -657,7 +648,7 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr 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_db->generation, + ctdb_db->db_id, hdr->generation, ctdb->vnn_map->generation, (unsigned long long)c->rsn, (unsigned long long)header.rsn, c->hdr.reqid)); } @@ -902,6 +893,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) return; } + ctdb_db = find_ctdb_db(ctdb, c->db_id); if (!ctdb_db) { ctdb_send_error(ctdb, hdr, -1, @@ -910,15 +902,6 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) 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); @@ -1193,15 +1176,6 @@ void ctdb_reply_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) 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 @@ -1296,16 +1270,7 @@ void ctdb_reply_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) 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]; |