[SCM] Samba Shared Repository - branch master updated
Amitay Isaacs
amitay at samba.org
Thu Nov 14 03:46:03 UTC 2019
The branch, master has been updated
via e45feaf28da ctdb-tcp: Simplify freeing of transport data on shutdown
via 750f3938e4f ctdb-daemon: Rename ctdb_context private_data to transport_data
via 53f8492caaf ctdb-daemon: Rename ctdb_node private_data to transport_data
via a6d99d9e5c5 ctdb-tcp: Close inflight connecting TCP sockets after fork
from 231397f45ee smbd: Make share_mode_do_locked() pass TDB_DATA instead of a record
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e45feaf28da27653e9df36c7c50cbd54a792a2aa
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Nov 12 12:14:18 2019 +1100
ctdb-tcp: Simplify freeing of transport data on shutdown
The type-checking is superfluous and gets in the way of readability.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
Autobuild-Date(master): Thu Nov 14 03:45:44 UTC 2019 on sn-devel-184
commit 750f3938e4fcd6743954db6b1132751a90ee6107
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Nov 12 12:12:46 2019 +1100
ctdb-daemon: Rename ctdb_context private_data to transport_data
This gives a casual reader a useful clue.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit 53f8492caafa8556d0c2d3f272d08ce5ce098c25
Author: Martin Schwenke <martin at meltin.net>
Date: Tue Nov 12 12:04:22 2019 +1100
ctdb-daemon: Rename ctdb_node private_data to transport_data
This gives a casual reader a useful clue.
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
commit a6d99d9e5c5bc58e6d56be7a6c1dbc7c8d1a882f
Author: Volker Lendecke <vl at samba.org>
Date: Thu Nov 7 15:26:01 2019 +0100
ctdb-tcp: Close inflight connecting TCP sockets after fork
Commit c68b6f96f26 changed the talloc hierarchy such that outgoing TCP sockets
while sitting in the async connect() syscall are not freed via
ctdb_tcp_shutdown() anymore, they are hanging off a longer-running structure.
Free this structure as well.
If an outgoing TCP socket leaks into a long-running child process (possibly the
recovery daemon), this connection will never be closed as seen by the
destination node. Because with recent changes incoming connections will not be
accepted as long as any incoming connection is alive, with that socket leak
into the recovery daemon we will never again be able to successfully connect to
the node that is affected by this leak. Further attempts to connect will be
discarded by the destination as long as the recovery daemon keeps this socket
alive.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175
RN: Avoid communication breakdown on node reconnect
Signed-off-by: Martin Schwenke <martin at meltin.net>
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
-----------------------------------------------------------------------
Summary of changes:
ctdb/ib/ibw_ctdb.c | 11 ++++++++---
ctdb/ib/ibw_ctdb_init.c | 13 ++++++++-----
ctdb/include/ctdb_private.h | 4 ++--
ctdb/tcp/tcp_connect.c | 17 +++++++++--------
ctdb/tcp/tcp_init.c | 21 ++++++++++++---------
ctdb/tcp/tcp_io.c | 4 ++--
6 files changed, 41 insertions(+), 29 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/ib/ibw_ctdb.c b/ctdb/ib/ibw_ctdb.c
index b5537c8a7e5..38314c32ebc 100644
--- a/ctdb/ib/ibw_ctdb.c
+++ b/ctdb/ib/ibw_ctdb.c
@@ -55,7 +55,8 @@ int ctdb_ibw_get_address(struct ctdb_context *ctdb,
int ctdb_ibw_node_connect(struct ctdb_node *node)
{
- struct ctdb_ibw_node *cn = talloc_get_type(node->private_data, struct ctdb_ibw_node);
+ struct ctdb_ibw_node *cn = talloc_get_type(node->transport_data,
+ struct ctdb_ibw_node);
int rc;
assert(cn!=NULL);
@@ -118,7 +119,9 @@ int ctdb_ibw_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
case IBWC_CONNECTED: { /* after ibw_accept or ibw_connect */
struct ctdb_node *node = talloc_get_type(conn->conn_userdata, struct ctdb_node);
if (node!=NULL) { /* after ibw_connect */
- struct ctdb_ibw_node *cn = talloc_get_type(node->private_data, struct ctdb_ibw_node);
+ struct ctdb_ibw_node *cn = talloc_get_type(
+ node->transport_data,
+ struct ctdb_ibw_node);
node->ctdb->upcalls->node_connected(node);
ctdb_flush_cn_queue(cn);
@@ -136,7 +139,9 @@ int ctdb_ibw_connstate_handler(struct ibw_ctx *ctx, struct ibw_conn *conn)
case IBWC_ERROR: {
struct ctdb_node *node = talloc_get_type(conn->conn_userdata, struct ctdb_node);
if (node!=NULL) {
- struct ctdb_ibw_node *cn = talloc_get_type(node->private_data, struct ctdb_ibw_node);
+ struct ctdb_ibw_node *cn = talloc_get_type(
+ node->transport_data,
+ struct ctdb_ibw_node);
struct ibw_ctx *ictx = cn->conn->ctx;
DEBUG(DEBUG_DEBUG, ("IBWC_ERROR, reconnecting...\n"));
diff --git a/ctdb/ib/ibw_ctdb_init.c b/ctdb/ib/ibw_ctdb_init.c
index 7e77ec08031..f9d00c60605 100644
--- a/ctdb/ib/ibw_ctdb_init.c
+++ b/ctdb/ib/ibw_ctdb_init.c
@@ -40,7 +40,8 @@
static int ctdb_ibw_listen(struct ctdb_context *ctdb, int backlog)
{
- struct ibw_ctx *ictx = talloc_get_type(ctdb->private_data, struct ibw_ctx);
+ struct ibw_ctx *ictx = talloc_get_type(ctdb->transport_data,
+ struct ibw_ctx);
assert(ictx!=NULL);
@@ -62,12 +63,13 @@ static int ctdb_ibw_listen(struct ctdb_context *ctdb, int backlog)
*/
static int ctdb_ibw_add_node(struct ctdb_node *node)
{
- struct ibw_ctx *ictx = talloc_get_type(node->ctdb->private_data, struct ibw_ctx);
+ struct ibw_ctx *ictx = talloc_get_type(node->ctdb->transport_data,
+ struct ibw_ctx);
struct ctdb_ibw_node *cn = talloc_zero(node, struct ctdb_ibw_node);
assert(cn!=NULL);
cn->conn = ibw_conn_new(ictx, node);
- node->private_data = (void *)cn;
+ node->transport_data = (void *)cn;
return (cn->conn!=NULL ? 0 : -1);
}
@@ -153,7 +155,8 @@ int ctdb_flush_cn_queue(struct ctdb_ibw_node *cn)
static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t length)
{
- struct ctdb_ibw_node *cn = talloc_get_type(node->private_data, struct ctdb_ibw_node);
+ struct ctdb_ibw_node *cn = talloc_get_type(node->transport_data,
+ struct ctdb_ibw_node);
int rc;
assert(length>=sizeof(uint32_t));
@@ -245,7 +248,7 @@ int ctdb_ibw_init(struct ctdb_context *ctdb)
}
ctdb->methods = &ctdb_ibw_methods;
- ctdb->private_data = ictx;
+ ctdb->transport_data = ictx;
DEBUG(DEBUG_DEBUG, ("ctdb_ibw_init succeeded.\n"));
return 0;
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 47c339a36d6..6aba3c1d48e 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -74,7 +74,7 @@ struct ctdb_node {
struct ctdb_context *ctdb;
ctdb_sock_addr address;
const char *name; /* for debug messages */
- void *private_data; /* private to transport */
+ void *transport_data; /* private to transport */
uint32_t pnn;
uint32_t flags;
@@ -286,7 +286,7 @@ struct ctdb_context {
char *err_msg;
const struct ctdb_methods *methods; /* transport methods */
const struct ctdb_upcalls *upcalls; /* transport upcalls */
- void *private_data; /* private to transport */
+ void *transport_data; /* private to transport */
struct ctdb_db_context *db_list;
struct srvid_context *srv;
struct srvid_context *tunnels;
diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c
index b0572881880..f54086fcd3c 100644
--- a/ctdb/tcp/tcp_connect.c
+++ b/ctdb/tcp/tcp_connect.c
@@ -43,7 +43,7 @@
void ctdb_tcp_stop_connection(struct ctdb_node *node)
{
struct ctdb_tcp_node *tnode = talloc_get_type(
- node->private_data, struct ctdb_tcp_node);
+ node->transport_data, struct ctdb_tcp_node);
TALLOC_FREE(tnode->out_queue);
TALLOC_FREE(tnode->connect_te);
@@ -63,7 +63,7 @@ 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->private_data, struct ctdb_tcp_node);
+ node->transport_data, struct ctdb_tcp_node);
if (data == NULL) {
node->ctdb->upcalls->node_dead(node);
@@ -85,7 +85,7 @@ static void ctdb_node_connect_write(struct tevent_context *ev,
{
struct ctdb_node *node = talloc_get_type(private_data,
struct ctdb_node);
- struct ctdb_tcp_node *tnode = talloc_get_type(node->private_data,
+ struct ctdb_tcp_node *tnode = talloc_get_type(node->transport_data,
struct ctdb_tcp_node);
struct ctdb_context *ctdb = node->ctdb;
int error = 0;
@@ -165,7 +165,7 @@ void ctdb_tcp_node_connect(struct tevent_context *ev, struct tevent_timer *te,
{
struct ctdb_node *node = talloc_get_type(private_data,
struct ctdb_node);
- struct ctdb_tcp_node *tnode = talloc_get_type(node->private_data,
+ struct ctdb_tcp_node *tnode = talloc_get_type(node->transport_data,
struct ctdb_tcp_node);
struct ctdb_context *ctdb = node->ctdb;
ctdb_sock_addr sock_in;
@@ -277,7 +277,8 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
uint16_t flags, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
- struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data, struct ctdb_tcp);
+ struct ctdb_tcp *ctcp = talloc_get_type(ctdb->transport_data,
+ struct ctdb_tcp);
ctdb_sock_addr addr;
socklen_t len;
int fd;
@@ -300,7 +301,7 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
return;
}
- tnode = talloc_get_type_abort(node->private_data,
+ tnode = talloc_get_type_abort(node->transport_data,
struct ctdb_tcp_node);
if (tnode == NULL) {
/* This can't happen - see ctdb_tcp_initialise() */
@@ -368,7 +369,7 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
*/
static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb)
{
- struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data,
+ struct ctdb_tcp *ctcp = talloc_get_type(ctdb->transport_data,
struct ctdb_tcp);
ctdb_sock_addr sock;
int lock_fd;
@@ -509,7 +510,7 @@ failed:
*/
int ctdb_tcp_listen(struct ctdb_context *ctdb)
{
- struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data,
+ struct ctdb_tcp *ctcp = talloc_get_type(ctdb->transport_data,
struct ctdb_tcp);
ctdb_sock_addr sock;
int sock_size;
diff --git a/ctdb/tcp/tcp_init.c b/ctdb/tcp/tcp_init.c
index 3be16bd7d5e..559ad8691d0 100644
--- a/ctdb/tcp/tcp_init.c
+++ b/ctdb/tcp/tcp_init.c
@@ -58,7 +58,7 @@ static int ctdb_tcp_add_node(struct ctdb_node *node)
tnode->out_fd = -1;
tnode->ctdb = node->ctdb;
- node->private_data = tnode;
+ node->transport_data = tnode;
talloc_set_destructor(tnode, tnode_destructor);
return 0;
@@ -97,7 +97,7 @@ static int ctdb_tcp_connect_node(struct ctdb_node *node)
{
struct ctdb_context *ctdb = node->ctdb;
struct ctdb_tcp_node *tnode = talloc_get_type(
- node->private_data, struct ctdb_tcp_node);
+ node->transport_data, struct ctdb_tcp_node);
/* startup connection to the other server - will happen on
next event loop */
@@ -118,7 +118,7 @@ static int ctdb_tcp_connect_node(struct ctdb_node *node)
static void ctdb_tcp_restart(struct ctdb_node *node)
{
struct ctdb_tcp_node *tnode = talloc_get_type(
- node->private_data, struct ctdb_tcp_node);
+ node->transport_data, struct ctdb_tcp_node);
DEBUG(DEBUG_NOTICE,("Tearing down connection to dead node :%d\n", node->pnn));
@@ -135,10 +135,13 @@ static void ctdb_tcp_restart(struct ctdb_node *node)
*/
static void ctdb_tcp_shutdown(struct ctdb_context *ctdb)
{
- struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data,
- struct ctdb_tcp);
- talloc_free(ctcp);
- ctdb->private_data = NULL;
+ uint32_t i;
+
+ TALLOC_FREE(ctdb->transport_data);
+
+ for (i=0; i<ctdb->num_nodes; i++) {
+ TALLOC_FREE(ctdb->nodes[i]->transport_data);
+ }
}
/*
@@ -185,7 +188,7 @@ static const struct ctdb_methods ctdb_tcp_methods = {
static int tcp_ctcp_destructor(struct ctdb_tcp *ctcp)
{
- ctcp->ctdb->private_data = NULL;
+ ctcp->ctdb->transport_data = NULL;
ctcp->ctdb->methods = NULL;
return 0;
@@ -203,7 +206,7 @@ int ctdb_tcp_init(struct ctdb_context *ctdb)
ctcp->listen_fd = -1;
ctcp->ctdb = ctdb;
- ctdb->private_data = ctcp;
+ ctdb->transport_data = ctcp;
ctdb->methods = &ctdb_tcp_methods;
talloc_set_destructor(ctcp, tcp_ctcp_destructor);
diff --git a/ctdb/tcp/tcp_io.c b/ctdb/tcp/tcp_io.c
index 2d8ec0f7062..df9ca02b413 100644
--- a/ctdb/tcp/tcp_io.c
+++ b/ctdb/tcp/tcp_io.c
@@ -39,7 +39,7 @@ 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(
- node->private_data, struct ctdb_tcp_node);
+ node->transport_data, struct ctdb_tcp_node);
struct ctdb_req_header *hdr = (struct ctdb_req_header *)data;
if (data == NULL) {
@@ -86,7 +86,7 @@ failed:
*/
int ctdb_tcp_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t length)
{
- struct ctdb_tcp_node *tnode = talloc_get_type(node->private_data,
+ struct ctdb_tcp_node *tnode = talloc_get_type(node->transport_data,
struct ctdb_tcp_node);
if (tnode->out_queue == NULL) {
DBG_DEBUG("No outgoing connection, dropping packet\n");
--
Samba Shared Repository
More information about the samba-cvs
mailing list