mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
ctdbd_conn: Move ctdbd_register_reconfigure to a callback
Move functionality out of ctdbd_conn to its right place into smbd Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
parent
a37398b9de
commit
d669bd8243
@ -82,8 +82,6 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
|
||||
void *private_data),
|
||||
void *private_data);
|
||||
|
||||
NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn);
|
||||
|
||||
NTSTATUS ctdbd_control_local(struct ctdbd_connection *conn, uint32_t opcode,
|
||||
uint64_t srvid, uint32_t flags, TDB_DATA data,
|
||||
TALLOC_CTX *mem_ctx, TDB_DATA *outdata,
|
||||
|
@ -52,11 +52,6 @@ NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid,
|
||||
return NT_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn)
|
||||
{
|
||||
return NT_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
|
||||
const struct sockaddr_storage *_server,
|
||||
const struct sockaddr_storage *_client,
|
||||
|
@ -394,20 +394,6 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid,
|
||||
goto next_pkt;
|
||||
}
|
||||
|
||||
if ((msg->srvid == CTDB_SRVID_RECONFIGURE)
|
||||
|| (msg->srvid == CTDB_SRVID_SAMBA_NOTIFY)) {
|
||||
|
||||
DEBUG(1, ("ctdb_read_req: Got %s message\n",
|
||||
(msg->srvid == CTDB_SRVID_RECONFIGURE)
|
||||
? "cluster reconfigure" : "SAMBA_NOTIFY"));
|
||||
|
||||
messaging_send(conn->msg_ctx,
|
||||
messaging_server_id(conn->msg_ctx),
|
||||
MSG_SMB_BRL_VALIDATE, &data_blob_null);
|
||||
TALLOC_FREE(hdr);
|
||||
goto next_pkt;
|
||||
}
|
||||
|
||||
ctdbd_msg_call_back(conn, msg);
|
||||
TALLOC_FREE(hdr);
|
||||
goto next_pkt;
|
||||
@ -508,12 +494,6 @@ NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
status = register_with_ctdbd(conn, CTDB_SRVID_SAMBA_NOTIFY,
|
||||
NULL, NULL);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*pconn = conn;
|
||||
return NT_STATUS_OK;
|
||||
|
||||
@ -571,21 +551,6 @@ static NTSTATUS ctdb_handle_message(struct messaging_context *msg_ctx,
|
||||
|
||||
SMB_ASSERT(conn->msg_ctx != NULL);
|
||||
|
||||
if ((msg->srvid == CTDB_SRVID_RECONFIGURE)
|
||||
|| (msg->srvid == CTDB_SRVID_SAMBA_NOTIFY)){
|
||||
DEBUG(0,("Got cluster reconfigure message\n"));
|
||||
/*
|
||||
* when the cluster is reconfigured or someone of the
|
||||
* family has passed away (SAMBA_NOTIFY), we need to
|
||||
* clean the brl database
|
||||
*/
|
||||
messaging_send(conn->msg_ctx,
|
||||
messaging_server_id(conn->msg_ctx),
|
||||
MSG_SMB_BRL_VALIDATE, &data_blob_null);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
ctdbd_msg_call_back(conn, msg);
|
||||
|
||||
return NT_STATUS_OK;
|
||||
@ -1583,14 +1548,6 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn,
|
||||
CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* We want to handle reconfigure events
|
||||
*/
|
||||
NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn)
|
||||
{
|
||||
return register_with_ctdbd(conn, CTDB_SRVID_RECONFIGURE, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
call a control on the local node
|
||||
*/
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "lib/smbd_shim.h"
|
||||
#include "scavenger.h"
|
||||
#include "locking/leases_db.h"
|
||||
#include "../../ctdb/include/ctdb_protocol.h"
|
||||
|
||||
struct smbd_open_socket;
|
||||
struct smbd_child_pid;
|
||||
@ -260,6 +261,23 @@ static void smbd_parent_id_cache_delete(struct messaging_context *ctx,
|
||||
messaging_send_to_children(ctx, msg_type, msg_data);
|
||||
}
|
||||
|
||||
static void smbd_parent_ctdb_reconfigured(struct ctdb_req_message *msg,
|
||||
void *private_data)
|
||||
{
|
||||
struct messaging_context *msg_ctx = talloc_get_type_abort(
|
||||
private_data, struct messaging_context);
|
||||
|
||||
DEBUG(10, ("Got %s message\n", (msg->srvid == CTDB_SRVID_RECONFIGURE)
|
||||
? "cluster reconfigure" : "SAMBA_NOTIFY"));
|
||||
|
||||
/*
|
||||
* Someone from the family died, validate our locks
|
||||
*/
|
||||
|
||||
messaging_send_buf(msg_ctx, messaging_server_id(msg_ctx),
|
||||
MSG_SMB_BRL_VALIDATE, NULL, 0);
|
||||
}
|
||||
|
||||
struct smbd_parent_notify_state {
|
||||
struct tevent_context *ev;
|
||||
struct messaging_context *msg;
|
||||
@ -898,7 +916,12 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
|
||||
ID_CACHE_KILL, smbd_parent_id_cache_kill);
|
||||
|
||||
if (lp_clustering()) {
|
||||
ctdbd_register_reconfigure(messaging_ctdbd_connection());
|
||||
struct ctdbd_connection *conn = messaging_ctdbd_connection();
|
||||
|
||||
register_with_ctdbd(conn, CTDB_SRVID_RECONFIGURE,
|
||||
smbd_parent_ctdb_reconfigured, msg_ctx);
|
||||
register_with_ctdbd(conn, CTDB_SRVID_SAMBA_NOTIFY,
|
||||
smbd_parent_ctdb_reconfigured, msg_ctx);
|
||||
}
|
||||
|
||||
#ifdef DEVELOPER
|
||||
|
Loading…
Reference in New Issue
Block a user