mirror of
https://github.com/samba-team/samba.git
synced 2025-01-25 06:04:04 +03:00
recoverd: Make the SRVID request structure generic
No need for a separate one for each SRVID. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit d9c22b04d5aa7938a3965bd3144568664eb772ce)
This commit is contained in:
parent
c503997746
commit
4c3f8dc3bb
@ -24,19 +24,12 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
recovery daemon memdump reply address
|
* Structure to support SRVID requests and replies
|
||||||
*/
|
*/
|
||||||
struct rd_memdump_reply {
|
struct srvid_request {
|
||||||
uint32_t pnn;
|
|
||||||
uint64_t srvid;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
description for a TAKEOVER_RUN message reply address
|
|
||||||
*/
|
|
||||||
struct takeover_run_reply {
|
|
||||||
uint32_t pnn;
|
uint32_t pnn;
|
||||||
uint64_t srvid;
|
uint64_t srvid;
|
||||||
|
uint32_t data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -113,7 +113,7 @@ static void ctdb_health_callback(struct ctdb_context *ctdb, int status, void *p)
|
|||||||
uint32_t next_interval;
|
uint32_t next_interval;
|
||||||
int ret;
|
int ret;
|
||||||
TDB_DATA rddata;
|
TDB_DATA rddata;
|
||||||
struct takeover_run_reply rd;
|
struct srvid_request rd;
|
||||||
const char *state_str = NULL;
|
const char *state_str = NULL;
|
||||||
|
|
||||||
c.pnn = ctdb->pnn;
|
c.pnn = ctdb->pnn;
|
||||||
|
@ -40,7 +40,7 @@ struct reloadips_all_reply *reload_all_ips_request = NULL;
|
|||||||
*/
|
*/
|
||||||
struct ip_reallocate_list {
|
struct ip_reallocate_list {
|
||||||
struct ip_reallocate_list *next;
|
struct ip_reallocate_list *next;
|
||||||
struct rd_memdump_reply *rd;
|
struct srvid_request *rd;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ctdb_banning_state {
|
struct ctdb_banning_state {
|
||||||
@ -2162,14 +2162,14 @@ static void mem_dump_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
|||||||
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
|
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
|
||||||
TDB_DATA *dump;
|
TDB_DATA *dump;
|
||||||
int ret;
|
int ret;
|
||||||
struct rd_memdump_reply *rd;
|
struct srvid_request *rd;
|
||||||
|
|
||||||
if (data.dsize != sizeof(struct rd_memdump_reply)) {
|
if (data.dsize != sizeof(struct srvid_request)) {
|
||||||
DEBUG(DEBUG_ERR, (__location__ " Wrong size of return address.\n"));
|
DEBUG(DEBUG_ERR, (__location__ " Wrong size of return address.\n"));
|
||||||
talloc_free(tmp_ctx);
|
talloc_free(tmp_ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rd = (struct rd_memdump_reply *)data.dptr;
|
rd = (struct srvid_request *)data.dptr;
|
||||||
|
|
||||||
dump = talloc_zero(tmp_ctx, TDB_DATA);
|
dump = talloc_zero(tmp_ctx, TDB_DATA);
|
||||||
if (dump == NULL) {
|
if (dump == NULL) {
|
||||||
@ -2441,9 +2441,9 @@ reload_all_ips(struct ctdb_context *ctdb, struct ctdb_recoverd *rec, struct ctdb
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
handler for ip reallocate, just add it to the list of callers and
|
handler for ip reallocate, just add it to the list of requests and
|
||||||
handle this later in the monitor_cluster loop so we do not recurse
|
handle this later in the monitor_cluster loop so we do not recurse
|
||||||
with other callers to takeover_run()
|
with other requests to takeover_run()
|
||||||
*/
|
*/
|
||||||
static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
||||||
TDB_DATA data, void *private_data)
|
TDB_DATA data, void *private_data)
|
||||||
@ -2451,7 +2451,7 @@ static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
|||||||
struct ctdb_recoverd *rec = talloc_get_type(private_data, struct ctdb_recoverd);
|
struct ctdb_recoverd *rec = talloc_get_type(private_data, struct ctdb_recoverd);
|
||||||
struct ip_reallocate_list *caller;
|
struct ip_reallocate_list *caller;
|
||||||
|
|
||||||
if (data.dsize != sizeof(struct rd_memdump_reply)) {
|
if (data.dsize != sizeof(struct srvid_request)) {
|
||||||
DEBUG(DEBUG_ERR, (__location__ " Wrong size of return address.\n"));
|
DEBUG(DEBUG_ERR, (__location__ " Wrong size of return address.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2464,7 +2464,7 @@ static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid,
|
|||||||
caller = talloc(rec->ip_reallocate_ctx, struct ip_reallocate_list);
|
caller = talloc(rec->ip_reallocate_ctx, struct ip_reallocate_list);
|
||||||
CTDB_NO_MEMORY_FATAL(ctdb, caller);
|
CTDB_NO_MEMORY_FATAL(ctdb, caller);
|
||||||
|
|
||||||
caller->rd = (struct rd_memdump_reply *)talloc_steal(caller, data.dptr);
|
caller->rd = (struct srvid_request *)talloc_steal(caller, data.dptr);
|
||||||
caller->next = rec->reallocate_callers;
|
caller->next = rec->reallocate_callers;
|
||||||
rec->reallocate_callers = caller;
|
rec->reallocate_callers = caller;
|
||||||
|
|
||||||
@ -3112,7 +3112,7 @@ static int verify_local_ip_allocation(struct ctdb_context *ctdb, struct ctdb_rec
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (need_takeover_run) {
|
if (need_takeover_run) {
|
||||||
struct takeover_run_reply rd;
|
struct srvid_request rd;
|
||||||
TDB_DATA data;
|
TDB_DATA data;
|
||||||
|
|
||||||
DEBUG(DEBUG_CRIT,("Trigger takeoverrun\n"));
|
DEBUG(DEBUG_CRIT,("Trigger takeoverrun\n"));
|
||||||
|
@ -2005,7 +2005,7 @@ static int ipreallocate(struct ctdb_context *ctdb)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
TDB_DATA data;
|
TDB_DATA data;
|
||||||
struct takeover_run_reply rd;
|
struct srvid_request rd;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
/* Time ticks to enable timeouts to be processed */
|
/* Time ticks to enable timeouts to be processed */
|
||||||
@ -2015,6 +2015,7 @@ static int ipreallocate(struct ctdb_context *ctdb)
|
|||||||
|
|
||||||
rd.pnn = ctdb_get_pnn(ctdb);
|
rd.pnn = ctdb_get_pnn(ctdb);
|
||||||
rd.srvid = getpid();
|
rd.srvid = getpid();
|
||||||
|
rd.data = 0;
|
||||||
|
|
||||||
/* Register message port for reply from recovery master */
|
/* Register message port for reply from recovery master */
|
||||||
ctdb_client_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler, NULL);
|
ctdb_client_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler, NULL);
|
||||||
@ -5713,7 +5714,7 @@ static int control_rddumpmemory(struct ctdb_context *ctdb, int argc, const char
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
TDB_DATA data;
|
TDB_DATA data;
|
||||||
struct rd_memdump_reply rd;
|
struct srvid_request rd;
|
||||||
|
|
||||||
rd.pnn = ctdb_get_pnn(ctdb);
|
rd.pnn = ctdb_get_pnn(ctdb);
|
||||||
rd.srvid = getpid();
|
rd.srvid = getpid();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user