]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
fixed a race condition in the handling of the recovery lock
authorAndrew Tridgell <tridge@samba.org>
Sun, 3 Jun 2007 00:29:14 +0000 (10:29 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 3 Jun 2007 00:29:14 +0000 (10:29 +1000)
(This used to be ctdb commit 3b98c5ad23662259b0eed399ab0c8037cf9b2b0b)

ctdb/common/ctdb_call.c
ctdb/common/ctdb_recover.c
ctdb/common/ctdb_recoverd.c

index 6145605b5ab77f273755e791bb5e75defdcc1252..9b71514991c33e4cea659c723ba27995d6de952c 100644 (file)
@@ -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;
        }
index 3f1b1506ae98d218a892a715d1fc2c06a4c4e2db..24228469d6f0e70bc4a5f37abb5a842c59a44a6e 100644 (file)
@@ -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;
        }       
 
index 20ad94aec4041c7da7ecfc2291f8462043627478..70b980ca0635c75fd35f54626c40b6bacd0b4098 100644 (file)
@@ -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;
        }