From: Andrew Tridgell Date: Sun, 3 Jun 2007 00:29:14 +0000 (+1000) Subject: fixed a race condition in the handling of the recovery lock X-Git-Tag: tevent-0.9.20~348^2~2592 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=518d410075054bb8326cc4f65e1c71af35f20d97;p=thirdparty%2Fsamba.git fixed a race condition in the handling of the recovery lock (This used to be ctdb commit 3b98c5ad23662259b0eed399ab0c8037cf9b2b0b) --- diff --git a/ctdb/common/ctdb_call.c b/ctdb/common/ctdb_call.c index 6145605b5ab..9b71514991c 100644 --- a/ctdb/common/ctdb_call.c +++ b/ctdb/common/ctdb_call.c @@ -394,8 +394,9 @@ void ctdb_request_dmaster(struct ctdb_context *ctdb, struct ctdb_req_header *hdr /* its a protocol error if the sending node is not the current dmaster */ if (header.dmaster != hdr->srcnode) { - DEBUG(0,("vnn %u dmaster request non-master %u dmaster=%u key %08x\n", - ctdb->vnn, hdr->srcnode, header.dmaster, ctdb_hash(&key))); + DEBUG(0,("vnn %u dmaster request non-master %u dmaster=%u key %08x dbid 0x%08x\n", + ctdb->vnn, hdr->srcnode, header.dmaster, ctdb_hash(&key), + ctdb_db->db_id)); ctdb_fatal(ctdb, "ctdb_req_dmaster from non-master"); return; } diff --git a/ctdb/common/ctdb_recover.c b/ctdb/common/ctdb_recover.c index 3f1b1506ae9..24228469d6f 100644 --- a/ctdb/common/ctdb_recover.c +++ b/ctdb/common/ctdb_recover.c @@ -487,8 +487,8 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb, /* we should not be able to get the lock on the nodes list, as it should be held by the recovery master */ if (ctdb_recovery_lock(ctdb, false)) { - DEBUG(0,("ERROR: node list not locked when recovering!\n")); - ctdb_fatal(ctdb, "node list not locked - make sure it is on shared storage"); + DEBUG(0,("ERROR: recovery lock file %s not locked when recovering!\n", + ctdb->recovery_lock_file)); return -1; } diff --git a/ctdb/common/ctdb_recoverd.c b/ctdb/common/ctdb_recoverd.c index 20ad94aec40..70b980ca063 100644 --- a/ctdb/common/ctdb_recoverd.c +++ b/ctdb/common/ctdb_recoverd.c @@ -614,7 +614,8 @@ static void election_handler(struct ctdb_context *ctdb, uint64_t srvid, } /* release the recmaster lock */ - if (ctdb->recovery_lock_fd != -1) { + if (em->vnn != ctdb_get_vnn(ctdb) && + ctdb->recovery_lock_fd != -1) { close(ctdb->recovery_lock_fd); ctdb->recovery_lock_fd = -1; }