recoverd: Only respond to currently queued ipreallocated requests
authorMartin Schwenke <martin@meltin.net>
Fri, 22 Nov 2013 02:57:03 +0000 (13:57 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 25 Nov 2013 03:25:45 +0000 (14:25 +1100)
Otherwise new requests can come in during the latter parts of the
takeover run when the IP allocation algorithm has already run, and the
new requests will be dequeued even though they haven't really be
processed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

server/ctdb_recoverd.c

index 70ed87e355a4f212ed19b93dd6a8050b58900009..c5cd36cfa9230558671b81c4c5997a9a9c200d1a 100644 (file)
@@ -2606,9 +2606,18 @@ static void process_ipreallocate_requests(struct ctdb_context *ctdb,
        TDB_DATA result;
        int32_t ret;
        uint32_t culprit;
+       struct srvid_requests *current;
 
        DEBUG(DEBUG_INFO, ("recovery master forced ip reallocation\n"));
 
+       /* Only process requests that are currently pending.  More
+        * might come in while the takeover run is in progress and
+        * they will need to be processed later since they might
+        * be in response flag changes.
+        */
+       current = rec->reallocate_requests;
+       rec->reallocate_requests = NULL;
+
        /* update the list of public ips that a node can handle for
           all connected nodes
        */
@@ -2629,7 +2638,7 @@ static void process_ipreallocate_requests(struct ctdb_context *ctdb,
        result.dsize = sizeof(int32_t);
        result.dptr  = (uint8_t *)&ret;
 
-       srvid_requests_reply(ctdb, &rec->reallocate_requests, result);
+       srvid_requests_reply(ctdb, &current, result);
 }