diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-10-19 09:39:07 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2007-10-19 09:39:07 +1000 |
commit | f47f758fe86dcaa77c8d6fdc67553a0f0dbfe63a (patch) | |
tree | dbfeb12c18b6a9484c02de57dba5a5ccf9920a35 | |
parent | 623e216dcf02de0afbf9c5cea350818943eafdde (diff) | |
parent | e81e008a36bf94248acef72aa526f153bbec32eb (diff) | |
download | samba-f47f758fe86dcaa77c8d6fdc67553a0f0dbfe63a.tar.gz samba-f47f758fe86dcaa77c8d6fdc67553a0f0dbfe63a.tar.xz samba-f47f758fe86dcaa77c8d6fdc67553a0f0dbfe63a.zip |
merge from ronnie
(This used to be ctdb commit d444fdc7782496abe4b27003b647ac49fb52e6be)
-rw-r--r-- | ctdb/ib/ibw_ctdb_init.c | 7 | ||||
-rw-r--r-- | ctdb/include/ctdb_private.h | 1 | ||||
-rw-r--r-- | ctdb/server/ctdb_server.c | 7 | ||||
-rw-r--r-- | ctdb/tcp/tcp_init.c | 19 |
4 files changed, 32 insertions, 2 deletions
diff --git a/ctdb/ib/ibw_ctdb_init.c b/ctdb/ib/ibw_ctdb_init.c index 8dbb9c241cc..28b7a0374c6 100644 --- a/ctdb/ib/ibw_ctdb_init.c +++ b/ctdb/ib/ibw_ctdb_init.c @@ -177,6 +177,12 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le return rc; } +static void ctdb_ibw_restart(struct ctdb_node *node) +{ + /* TODO: implement this method for IB */ + DEBUG(0,("WARNING: method restart is not yet implemented for IB\n")); +} + /* * transport packet allocator - allows transport to control memory for packets */ @@ -204,6 +210,7 @@ static const struct ctdb_methods ctdb_ibw_methods = { .queue_pkt = ctdb_ibw_queue_pkt, .add_node = ctdb_ibw_add_node, .allocate_pkt = ctdb_ibw_allocate_pkt, + .restart = ctdb_ibw_restart, // .stop = ctdb_ibw_stop }; diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 3298106d629..4eeb17ec8de 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -207,6 +207,7 @@ struct ctdb_methods { int (*queue_pkt)(struct ctdb_node *, uint8_t *data, uint32_t length); void *(*allocate_pkt)(TALLOC_CTX *mem_ctx, size_t ); void (*shutdown)(struct ctdb_context *); /* shutdown transport */ + void (*restart)(struct ctdb_node *); /* stop and restart the connection */ }; /* diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c index 5c579f00228..dddf90753bd 100644 --- a/ctdb/server/ctdb_server.c +++ b/ctdb/server/ctdb_server.c @@ -120,7 +120,7 @@ static int ctdb_add_node(struct ctdb_context *ctdb, char *nstr) node->pnn = ctdb->num_nodes; /* nodes start out disconnected and unhealthy */ - node->flags |= NODE_FLAGS_DISCONNECTED | NODE_FLAGS_UNHEALTHY; + node->flags = (NODE_FLAGS_DISCONNECTED | NODE_FLAGS_UNHEALTHY); if (ctdb->address.address && ctdb_same_address(&ctdb->address, &node->address)) { @@ -338,9 +338,12 @@ void ctdb_node_dead(struct ctdb_node *node) node->flags |= NODE_FLAGS_DISCONNECTED | NODE_FLAGS_UNHEALTHY; node->rx_cnt = 0; node->dead_count = 0; - DEBUG(1,("%s: node %s is dead: %u connected\n", + + DEBUG(0,("%s: node %s is dead: %u connected\n", node->ctdb->name, node->name, node->ctdb->num_connected)); ctdb_daemon_cancel_controls(node->ctdb, node); + + node->ctdb->methods->restart(node); } /* diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c index f5d4e4c1d6b..1b186c3f400 100644 --- a/ctdb/tcp/tcp_init.c +++ b/ctdb/tcp/tcp_init.c @@ -88,6 +88,24 @@ static int ctdb_tcp_start(struct ctdb_context *ctdb) return 0; } +/* + shutdown and try to restart a connection to a node after it has been + disconnected +*/ +static void ctdb_tcp_restart(struct ctdb_node *node) +{ + struct ctdb_tcp_node *tnode = talloc_get_type( + node->private_data, struct ctdb_tcp_node); + + DEBUG(0,("Tearing down connection to dead node :%d\n", node->pnn)); + + tnode->fd = -1; + ctdb_queue_set_fd(tnode->out_queue, -1); + + event_add_timed(node->ctdb->ev, tnode, timeval_zero(), + ctdb_tcp_node_connect, node); +} + /* shutdown the transport @@ -121,6 +139,7 @@ static const struct ctdb_methods ctdb_tcp_methods = { .add_node = ctdb_tcp_add_node, .allocate_pkt = ctdb_tcp_allocate_pkt, .shutdown = ctdb_tcp_shutdown, + .restart = ctdb_tcp_restart, }; /* |