[SCM] Samba Shared Repository - branch v4-12-test updated

Karolin Seeger kseeger at samba.org
Thu Mar 19 12:20:04 UTC 2020


The branch, v4-12-test has been updated
       via  25642c7e960 ctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect()
       via  e9b727b4f2b ctdb-tcp: Factor out function ctdb_tcp_start_outgoing()
       via  3b5af720a4c ctdb-tcp: add ctdb_tcp_stop_incoming()
       via  26e29f72182 ctdb-tcp: rename ctdb_tcp_stop_connection() to ctdb_tcp_stop_outgoing()
       via  167ef355b34 ctdb-tcp: Remove redundant restart in ctdb_tcp_tnode_cb()
       via  2e619f51b05 ctdb-tcp: always call node_dead() upcall in ctdb_tcp_tnode_cb()
       via  5a51d36317d ctdb-tcp: move free of inbound queue to TCP restart
       via  6f6357c359c ctdb-daemon: more logical whitespace, debug modernisation
       via  0706d539417 ctdb-daemon: ensure restart() callback is called in half-connected state
      from  f50790c1be7 nmblib: avoid undefined behaviour in handle_name_ptrs()

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-12-test


- Log -----------------------------------------------------------------
commit 25642c7e960d0c83c9fa1eac7f8e0fbb28f90dd7
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Mar 6 16:11:23 2020 +1100

    ctdb-tcp: Do not stop outbound connection in ctdb_tcp_node_connect()
    
    The only place the outgoing connection needs to be stopped is when
    there is a timeout when waiting for the connection to become writable.
    Add a new function ctdb_tcp_node_connect_timeout() to handle this
    case.
    
    All of the other cases are attempts to establish a new outgoing
    connection (initial attempt, retry after an error or disconnect, ...)
    so drop stopping the connection in those cases.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Thu Mar 12 05:29:20 UTC 2020 on sn-devel-184
    
    (cherry picked from commit 319c93f0c6a949545229b616dfbd4f51baf11171)
    
    Autobuild-User(v4-12-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-12-test): Thu Mar 19 12:19:52 UTC 2020 on sn-devel-184

commit e9b727b4f2b95c72087cd6edb3562ef7d9e3d442
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Mar 6 15:59:32 2020 +1100

    ctdb-tcp: Factor out function ctdb_tcp_start_outgoing()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 3c8747fe29486a4f95308b335a5e3ec1807f62cb)

commit 3b5af720a4c3d218255a73229ed4591c402f8bdc
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Feb 29 11:54:51 2020 +0100

    ctdb-tcp: add ctdb_tcp_stop_incoming()
    
    No change in behaviour.  This makes the code self-documenting.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 2c73dbafba50b28e72a8ec7b4382fae42fca6d17)

commit 26e29f7218225037e46ed3df697647bb8f7a89f5
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Feb 28 11:36:00 2020 +0100

    ctdb-tcp: rename ctdb_tcp_stop_connection() to ctdb_tcp_stop_outgoing()
    
    No change in behaviour.  This makes the code self-documenting.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 1e2a967ff41cc29c3a0d7f61a46937c68fdb90ba)

commit 167ef355b34ca03d3a8255823bebf975cd6e70b7
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Feb 29 12:28:20 2020 +0100

    ctdb-tcp: Remove redundant restart in ctdb_tcp_tnode_cb()
    
    The node dead upcall has already restarted the outgoing connection.
    There's no need to repeat it.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit ea37ecdcd5960311f54a7a5510b88a654da23daa)

commit 2e619f51b05203fdc3c9a4d9815cd1a567a214ae
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Feb 29 12:13:12 2020 +0100

    ctdb-tcp: always call node_dead() upcall in ctdb_tcp_tnode_cb()
    
    ctdb_tcp_tnode_cb() is called when we receive data on the outgoing connection.
    
    This can happen when we get an EOF on the connection because the other side as
    closed. In this case data will be NULL.
    
    It would also be called if we received data from the peer. In this case data
    will not be NULL.
    
    The latter case is a fatal error though and we already call
    ctdb_tcp_stop_connection() for this case as well, which means even though the
    node is not fully connected anymore, by not calling the node_dead() upcall
    NODE_FLAGS_DISCONNECTED will not be set.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit b83ef98c7466b2a81968555de83fb977bb6ca9f0)

commit 5a51d36317df92e589741c557ed61c64a43413bf
Author: Noel Power <noel.power at suse.com>
Date:   Sat Feb 29 15:49:28 2020 +0000

    ctdb-tcp: move free of inbound queue to TCP restart
    
    Since commit 77deaadca8e8dbc3c92ea16893099c72f6dc874e, a nodeA which
    had previously accepted a connection from nodeB (where nodeB dies
    e.g. as as result of fencing) when nodeB attempts to connect again
    after restarting is always rejected with
    
     ctdb_listen_event: Incoming queue active, rejecting connection from w.x.y.z
    
    messages.
    
    Consolidate dead node handling in the TCP restart handling.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 0ff1b78fc2f0491f9e11131d0040bdaba8873770)

commit 6f6357c359cb2a8017e2138a03b49da305e8f992
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun Mar 1 16:40:41 2020 +1100

    ctdb-daemon: more logical whitespace, debug modernisation
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 15762a34559599cf908e30651a2d4c11560068ed)

commit 0706d5394179324e988c00a9d1cabba10fcb3535
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Feb 29 12:26:19 2020 +0100

    ctdb-daemon: ensure restart() callback is called in half-connected state
    
    If NODE_FLAGS_DISCONNECTED is set the node can be in half-connected state. With
    this change we ensure to restart the transport for this case.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14295
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 6a4fa0785fc83561939fa41617d526eb96c1af89)

-----------------------------------------------------------------------

Summary of changes:
 ctdb/server/ctdb_server.c | 13 +++++----
 ctdb/tcp/ctdb_tcp.h       |  3 ++-
 ctdb/tcp/tcp_connect.c    | 67 ++++++++++++++++++++++++++++++++---------------
 ctdb/tcp/tcp_init.c       |  4 +--
 ctdb/tcp/tcp_io.c         |  1 -
 5 files changed, 56 insertions(+), 32 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index 0d5451d62a8..1470b00dba5 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -301,6 +301,12 @@ done:
 */
 void ctdb_node_dead(struct ctdb_node *node)
 {
+	if (node->ctdb->methods == NULL) {
+		DBG_ERR("Can not restart transport while shutting down\n");
+		return;
+	}
+	node->ctdb->methods->restart(node);
+
 	if (node->flags & NODE_FLAGS_DISCONNECTED) {
 		DEBUG(DEBUG_INFO,("%s: node %s is already marked disconnected: %u connected\n", 
 			 node->ctdb->name, node->name, 
@@ -315,13 +321,6 @@ void ctdb_node_dead(struct ctdb_node *node)
 	DEBUG(DEBUG_ERR,("%s: node %s is dead: %u connected\n",
 		 node->ctdb->name, node->name, node->ctdb->num_connected));
 	ctdb_daemon_cancel_controls(node->ctdb, node);
-
-	if (node->ctdb->methods == NULL) {
-		DEBUG(DEBUG_ERR,(__location__ " Can not restart transport while shutting down daemon.\n"));
-		return;
-	}
-
-	node->ctdb->methods->restart(node);
 }
 
 /*
diff --git a/ctdb/tcp/ctdb_tcp.h b/ctdb/tcp/ctdb_tcp.h
index daabad74297..cb8d66fa5dc 100644
--- a/ctdb/tcp/ctdb_tcp.h
+++ b/ctdb/tcp/ctdb_tcp.h
@@ -48,7 +48,8 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
 			   struct timeval t, void *private_data);
 void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args);
 void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private_data);
-void ctdb_tcp_stop_connection(struct ctdb_node *node);
+void ctdb_tcp_stop_outgoing(struct ctdb_node *node);
+void ctdb_tcp_stop_incoming(struct ctdb_node *node);
 
 #define CTDB_TCP_ALIGNMENT 8
 
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index 559442f14bf..f7703b77f0d 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -38,9 +38,9 @@
 #include "ctdb_tcp.h"
 
 /*
-  stop any connecting (established or pending) to a node
+  stop any outgoing connection (established or pending) to a node
  */
-void ctdb_tcp_stop_connection(struct ctdb_node *node)
+void ctdb_tcp_stop_outgoing(struct ctdb_node *node)
 {
 	struct ctdb_tcp_node *tnode = talloc_get_type(
 		node->transport_data, struct ctdb_tcp_node);
@@ -54,6 +54,16 @@ void ctdb_tcp_stop_connection(struct ctdb_node *node)
 	}
 }
 
+/*
+  stop incoming connection to a node
+ */
+void ctdb_tcp_stop_incoming(struct ctdb_node *node)
+{
+	struct ctdb_tcp_node *tnode = talloc_get_type(
+		node->transport_data, struct ctdb_tcp_node);
+
+	TALLOC_FREE(tnode->in_queue);
+}
 
 /*
   called when a complete packet has come in - should not happen on this socket
@@ -62,17 +72,9 @@ void ctdb_tcp_stop_connection(struct ctdb_node *node)
 void ctdb_tcp_tnode_cb(uint8_t *data, size_t cnt, void *private_data)
 {
 	struct ctdb_node *node = talloc_get_type(private_data, struct ctdb_node);
-	struct ctdb_tcp_node *tnode = talloc_get_type(
-		node->transport_data, struct ctdb_tcp_node);
 
-	if (data == NULL) {
-		node->ctdb->upcalls->node_dead(node);
-	}
+	node->ctdb->upcalls->node_dead(node);
 
-	ctdb_tcp_stop_connection(node);
-	tnode->connect_te = tevent_add_timer(node->ctdb->ev, tnode,
-					     timeval_current_ofs(3, 0),
-					     ctdb_tcp_node_connect, node);
 	TALLOC_FREE(data);
 }
 
@@ -97,7 +99,7 @@ static void ctdb_node_connect_write(struct tevent_context *ev,
 
 	ret = getsockopt(tnode->out_fd, SOL_SOCKET, SO_ERROR, &error, &len);
 	if (ret != 0 || error != 0) {
-		ctdb_tcp_stop_connection(node);
+		ctdb_tcp_stop_outgoing(node);
 		tnode->connect_te = tevent_add_timer(ctdb->ev, tnode,
 						    timeval_current_ofs(1, 0),
 						    ctdb_tcp_node_connect, node);
@@ -134,7 +136,7 @@ static void ctdb_node_connect_write(struct tevent_context *ev,
 					    node->name);
 	if (tnode->out_queue == NULL) {
 		DBG_ERR("Failed to set up outgoing queue\n");
-		ctdb_tcp_stop_connection(node);
+		ctdb_tcp_stop_outgoing(node);
 		tnode->connect_te = tevent_add_timer(ctdb->ev,
 						     tnode,
 						     timeval_current_ofs(1, 0),
@@ -157,14 +159,16 @@ static void ctdb_node_connect_write(struct tevent_context *ev,
 }
 
 
+static void ctdb_tcp_node_connect_timeout(struct tevent_context *ev,
+					  struct tevent_timer *te,
+					  struct timeval t,
+					  void *private_data);
+
 /*
   called when we should try and establish a tcp connection to a node
 */
-void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
-			   struct timeval t, void *private_data)
+static void ctdb_tcp_start_outgoing(struct ctdb_node *node)
 {
-	struct ctdb_node *node = talloc_get_type(private_data,
-						 struct ctdb_node);
 	struct ctdb_tcp_node *tnode = talloc_get_type(node->transport_data,
 						      struct ctdb_tcp_node);
 	struct ctdb_context *ctdb = node->ctdb;
@@ -174,8 +178,6 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
         ctdb_sock_addr sock_out;
 	int ret;
 
-	ctdb_tcp_stop_connection(node);
-
 	sock_out = node->address;
 
 	tnode->out_fd = socket(sock_out.sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
@@ -252,13 +254,13 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
 	tnode->connect_te = tevent_add_timer(ctdb->ev,
 					     tnode,
 					     timeval_current_ofs(1, 0),
-					     ctdb_tcp_node_connect,
+					     ctdb_tcp_node_connect_timeout,
 					     node);
 
 	return;
 
 failed:
-	ctdb_tcp_stop_connection(node);
+	ctdb_tcp_stop_outgoing(node);
 	tnode->connect_te = tevent_add_timer(ctdb->ev,
 					     tnode,
 					     timeval_current_ofs(1, 0),
@@ -266,6 +268,29 @@ failed:
 					     node);
 }
 
+void ctdb_tcp_node_connect(struct tevent_context *ev,
+			   struct tevent_timer *te,
+			   struct timeval t,
+			   void *private_data)
+{
+	struct ctdb_node *node = talloc_get_type_abort(private_data,
+						       struct ctdb_node);
+
+	ctdb_tcp_start_outgoing(node);
+}
+
+static void ctdb_tcp_node_connect_timeout(struct tevent_context *ev,
+					  struct tevent_timer *te,
+					  struct timeval t,
+					  void *private_data)
+{
+	struct ctdb_node *node = talloc_get_type_abort(private_data,
+						       struct ctdb_node);
+
+	ctdb_tcp_stop_outgoing(node);
+	ctdb_tcp_start_outgoing(node);
+}
+
 /*
   called when we get contacted by another node
   currently makes no attempt to check if the connection is really from a ctdb
diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c
index 559ad8691d0..97ebe1d887a 100644
--- a/ctdb/tcp/tcp_init.c
+++ b/ctdb/tcp/tcp_init.c
@@ -121,8 +121,8 @@ static void ctdb_tcp_restart(struct ctdb_node *node)
 		node->transport_data, struct ctdb_tcp_node);
 
 	DEBUG(DEBUG_NOTICE,("Tearing down connection to dead node :%d\n", node->pnn));
-
-	ctdb_tcp_stop_connection(node);
+	ctdb_tcp_stop_incoming(node);
+	ctdb_tcp_stop_outgoing(node);
 
 	tnode->connect_te = tevent_add_timer(node->ctdb->ev, tnode,
 					     timeval_zero(),
diff --git a/ctdb/tcp/tcp_io.c b/ctdb/tcp/tcp_io.c
index df9ca02b413..bcb18fbf300 100644
--- a/ctdb/tcp/tcp_io.c
+++ b/ctdb/tcp/tcp_io.c
@@ -75,7 +75,6 @@ void ctdb_tcp_read_cb(uint8_t *data, size_t cnt, void *args)
 	return;
 
 failed:
-	TALLOC_FREE(tnode->in_queue);
 	node->ctdb->upcalls->node_dead(node);
 
 	TALLOC_FREE(data);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list