summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-08-13 17:08:43 +1000
committerKarolin Seeger <kseeger@samba.org>2019-08-28 09:12:17 +0000
commit240ad91944d617d33b85aaeeed2a57ecf1ce9c67 (patch)
tree2509d762da728a5c65cc72555674fa88ad9f36ab /ctdb
parentadb19f17cd1a778a6ee58d7f4658b9f27ea087de (diff)
downloadsamba-240ad91944d617d33b85aaeeed2a57ecf1ce9c67.tar.gz
ctdb-tcp: Mark node as disconnected if incoming connection goes away
To make it easy to pass the node data to the upcall, the private data for ctdb_tcp_read_cb() needs to be changed from tnode to node. RN: Avoid marking a node as connected before it can receive packets BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Fri Aug 16 22:50:35 UTC 2019 on sn-devel-184 (cherry picked from commit 73c850eda4209b688a169aeeb20c453b738cbb35)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tcp/tcp_connect.c2
-rw-r--r--ctdb/tcp/tcp_io.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index fd635b9abf2..6123380ca9f 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -339,7 +339,7 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
fd,
CTDB_TCP_ALIGNMENT,
ctdb_tcp_read_cb,
- tnode,
+ node,
"ctdbd-%s",
ctdb_addr_to_str(&addr));
if (tnode->in_queue == NULL) {
diff --git a/ctdb/tcp/tcp_io.c b/ctdb/tcp/tcp_io.c
index e33ed44048e..e8ebff887e1 100644
--- a/ctdb/tcp/tcp_io.c
+++ b/ctdb/tcp/tcp_io.c
@@ -37,8 +37,9 @@
*/
void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args)
{
+ struct ctdb_node *node = talloc_get_type_abort(args, struct ctdb_node);
struct ctdb_tcp_node *tnode = talloc_get_type_abort(
- args, struct ctdb_tcp_node);
+ node->private_data, struct ctdb_tcp_node);
struct ctdb_req_header *hdr = (struct ctdb_req_header *)data;
if (data == NULL) {
@@ -77,6 +78,8 @@ failed:
TALLOC_FREE(tnode->in_queue);
close(tnode->in_fd);
tnode->in_fd = -1;
+ node->ctdb->upcalls->node_dead(node);
+
TALLOC_FREE(data);
}