summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2019-08-09 15:33:05 +1000
committerKarolin Seeger <kseeger@samba.org>2019-08-28 07:36:30 +0000
commit1e45ab3c23d74876069f69363519ec78af04bc0e (patch)
tree4cf8bf6c53344d92a392c08a4f1fe355ed92c1d6 /ctdb
parent9155ad23d43bfe00169980fba736579be1771b11 (diff)
downloadsamba-1e45ab3c23d74876069f69363519ec78af04bc0e.tar.gz
ctdb-tcp: Only mark a node connected if both directions are up
Nodes are currently marked as up if the outgoing connection is established. However, if the incoming connection is not yet established then this node could send a request where the replying node can not queue its reply. Wait until both directions are up before marking a node as connected. 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> (cherry picked from commit 8c98c10f242bc722beffc711e85c0e4f2e74cd57)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/tcp/tcp_connect.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index 15ce73103b9..e4d7f0dfd9c 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -148,8 +148,14 @@ static void ctdb_node_connect_write(struct tevent_context *ev,
/* the queue subsystem now owns this fd */
tnode->out_fd = -1;
- /* tell the ctdb layer we are connected */
- node->ctdb->upcalls->node_connected(node);
+ /*
+ * Mark the node to which this connection has been established
+ * as connected, but only if the corresponding listening
+ * socket is also connected
+ */
+ if (tnode->in_fd != -1) {
+ node->ctdb->upcalls->node_connected(node);
+ }
}
@@ -343,7 +349,15 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
}
tnode->in_fd = fd;
-}
+
+ /*
+ * Mark the connecting node as connected, but only if the
+ * corresponding outbound connected is also up
+ */
+ if (tnode->out_queue != NULL) {
+ node->ctdb->upcalls->node_connected(node);
+ }
+ }
/*