From 267645545f3ef28cf6714126b4baf92a96fb8c6e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 1 Jun 2017 17:45:47 +0200 Subject: [PATCH] ctdbd_conn: Pass "ev" through ctdb connection callbacks This prepares the same logic we've implemented in messages_dgm for clustering that is used in 6d3c064f1a5: We need to reply for messages from ctdb in nested event contexts properly. Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- source3/include/ctdbd_conn.h | 6 ++++-- source3/lib/ctdb_dummy.c | 6 ++++-- source3/lib/ctdbd_conn.c | 12 ++++++++---- source3/lib/messages_ctdbd.c | 1 + source3/smbd/notifyd/notifyd.c | 6 ++++-- source3/smbd/process.c | 3 ++- source3/smbd/server.c | 1 + 7 files changed, 24 insertions(+), 11 deletions(-) diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h index 38477d313de..471a67095c3 100644 --- a/source3/include/ctdbd_conn.h +++ b/source3/include/ctdbd_conn.h @@ -73,7 +73,8 @@ int ctdbd_traverse(struct ctdbd_connection *master, uint32_t db_id, int ctdbd_register_ips(struct ctdbd_connection *conn, const struct sockaddr_storage *server, const struct sockaddr_storage *client, - int (*cb)(uint32_t src_vnn, uint32_t dst_vnn, + int (*cb)(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data), @@ -89,7 +90,8 @@ int ctdb_unwatch(struct ctdbd_connection *conn); struct ctdb_req_message_old; int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid, - int (*cb)(uint32_t src_vnn, uint32_t dst_vnn, + int (*cb)(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data), diff --git a/source3/lib/ctdb_dummy.c b/source3/lib/ctdb_dummy.c index 2ed7b102a62..4e3e4bc81d4 100644 --- a/source3/lib/ctdb_dummy.c +++ b/source3/lib/ctdb_dummy.c @@ -38,7 +38,8 @@ int ctdbd_messaging_send_iov(struct ctdbd_connection *conn, } int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid, - int (*cb)(uint32_t src_vnn, uint32_t dst_vnn, + int (*cb)(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data), @@ -50,7 +51,8 @@ int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid, int ctdbd_register_ips(struct ctdbd_connection *conn, const struct sockaddr_storage *_server, const struct sockaddr_storage *_client, - int (*cb)(uint32_t src_vnn, uint32_t dst_vnn, + int (*cb)(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data), diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index b81feca65ba..fe4e0bc07b3 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -41,7 +41,8 @@ struct ctdbd_srvid_cb { uint64_t srvid; - int (*cb)(uint32_t src_vnn, uint32_t dst_vnn, + int (*cb)(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data); @@ -143,7 +144,8 @@ static void ctdb_packet_dump(struct ctdb_req_header *hdr) * Register a srvid with ctdbd */ int register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid, - int (*cb)(uint32_t src_vnn, uint32_t dst_vnn, + int (*cb)(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data), @@ -204,7 +206,8 @@ static int ctdbd_msg_call_back(struct ctdbd_connection *conn, if ((cb->srvid == msg->srvid) && (cb->cb != NULL)) { int ret; - ret = cb->cb(msg->hdr.srcnode, msg->hdr.destnode, + ret = cb->cb(NULL, + msg->hdr.srcnode, msg->hdr.destnode, msg->srvid, msg->data, msg->datalen, cb->private_data); if (ret != 0) { @@ -1138,7 +1141,8 @@ static void smbd_ctdb_canonicalize_ip(const struct sockaddr_storage *in, int ctdbd_register_ips(struct ctdbd_connection *conn, const struct sockaddr_storage *_server, const struct sockaddr_storage *_client, - int (*cb)(uint32_t src_vnn, uint32_t dst_vnn, + int (*cb)(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data), diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c index 6ecec32eeba..10696ac09df 100644 --- a/source3/lib/messages_ctdbd.c +++ b/source3/lib/messages_ctdbd.c @@ -109,6 +109,7 @@ static int messaging_ctdbd_destructor(struct messaging_ctdbd_context *ctx) } static int messaging_ctdb_recv( + struct tevent_context *ev, uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msg_len, void *private_data) { diff --git a/source3/smbd/notifyd/notifyd.c b/source3/smbd/notifyd/notifyd.c index caf894e956e..11059eca711 100644 --- a/source3/smbd/notifyd/notifyd.c +++ b/source3/smbd/notifyd/notifyd.c @@ -179,7 +179,8 @@ static int sys_notify_watch_dummy( #ifdef CLUSTER_SUPPORT static void notifyd_broadcast_reclog_finished(struct tevent_req *subreq); static void notifyd_clean_peers_finished(struct tevent_req *subreq); -static int notifyd_snoop_broadcast(uint32_t src_vnn, uint32_t dst_vnn, +static int notifyd_snoop_broadcast(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data); @@ -1387,7 +1388,8 @@ fail: * broadcast, which will then trigger a fresh database pull. */ -static int notifyd_snoop_broadcast(uint32_t src_vnn, uint32_t dst_vnn, +static int notifyd_snoop_broadcast(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data) diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 3765739d9c4..7de26f1388d 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2695,7 +2695,8 @@ static void smbd_release_ip_immediate(struct tevent_context *ctx, /**************************************************************************** received when we should release a specific IP ****************************************************************************/ -static int release_ip(uint32_t src_vnn, uint32_t dst_vnn, +static int release_ip(struct tevent_context *ev, + uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 181bcd1e123..76c2d2af285 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -276,6 +276,7 @@ static void smbd_parent_id_cache_delete(struct messaging_context *ctx, #ifdef CLUSTER_SUPPORT static int smbd_parent_ctdb_reconfigured( + struct tevent_context *ev, uint32_t src_vnn, uint32_t dst_vnn, uint64_t dst_srvid, const uint8_t *msg, size_t msglen, void *private_data) {