s3: Pass procid_self() explicitly to messaging_ctdbd_connection()
authorVolker Lendecke <vl@samba.org>
Sun, 4 Jul 2010 14:54:04 +0000 (16:54 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 5 Jul 2010 09:06:23 +0000 (11:06 +0200)
source3/include/messages.h
source3/lib/dbwrap_ctdb.c
source3/lib/g_lock.c
source3/lib/messages_ctdbd.c
source3/lib/util.c
source3/smbd/process.c
source3/smbd/server.c

index 805889a805dab6f9a7f3fa3d7858e26a2e75e80a..0e0019e8ab693fb1baea104c277724b851ab1a50 100644 (file)
@@ -116,7 +116,7 @@ bool messaging_tdb_parent_init(void);
 NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
                              TALLOC_CTX *mem_ctx,
                              struct messaging_backend **presult);
-struct ctdbd_connection *messaging_ctdbd_connection(void);
+struct ctdbd_connection *messaging_ctdbd_connection(struct server_id id);
 
 bool message_send_all(struct messaging_context *msg_ctx,
                      int msg_type,
index bef91cb1ec6e5d7f33d6b2ffd556d6a5b0f99df3..321a071aaab957ad24c398dd9ef39beb02536f4d 100644 (file)
@@ -794,7 +794,7 @@ static int db_ctdb_transaction_commit(struct db_context *db)
 
 again:
        /* tell ctdbd to commit to the other nodes */
-       rets = ctdbd_control_local(messaging_ctdbd_connection(),
+       rets = ctdbd_control_local(messaging_ctdbd_connection(procid_self()),
                                   CTDB_CONTROL_TRANS3_COMMIT,
                                   h->ctx->db_id, 0,
                                   db_ctdb_marshall_finish(h->m_write),
@@ -1005,7 +1005,9 @@ again:
                           ((struct ctdb_ltdb_header *)ctdb_data.dptr)->dmaster : -1,
                           get_my_vnn()));
 
-               status = ctdbd_migrate(messaging_ctdbd_connection(),ctx->db_id, key);
+               status = ctdbd_migrate(
+                       messaging_ctdbd_connection(procid_self()), ctx->db_id,
+                       key);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(5, ("ctdb_migrate failed: %s\n",
                                  nt_errstr(status)));
@@ -1110,7 +1112,8 @@ static int db_ctdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,
        SAFE_FREE(ctdb_data.dptr);
 
        /* we weren't able to get it locally - ask ctdb to fetch it for us */
-       status = ctdbd_fetch(messaging_ctdbd_connection(),ctx->db_id, key, mem_ctx, data);
+       status = ctdbd_fetch(messaging_ctdbd_connection(procid_self()),
+                            ctx->db_id, key, mem_ctx, data);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(5, ("ctdbd_fetch failed: %s\n", nt_errstr(status)));
                return -1;
@@ -1288,7 +1291,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
        db_ctdb->transaction = NULL;
        db_ctdb->db = result;
 
-       conn = messaging_ctdbd_connection();
+       conn = messaging_ctdbd_connection(procid_self());
 
        if (!NT_STATUS_IS_OK(ctdbd_db_attach(conn, name, &db_ctdb->db_id, tdb_flags))) {
                DEBUG(0, ("ctdbd_db_attach failed for %s\n", name));
index d7828e228f383270a9a1b78b50b7c0bd8ecd127a..49f719b5fc57a5de4b3463905234146e65d5abe8 100644 (file)
@@ -312,7 +312,8 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
 
 #ifdef CLUSTER_SUPPORT
        if (lp_clustering()) {
-               status = ctdb_watch_us(messaging_ctdbd_connection());
+               status = ctdb_watch_us(
+                       messaging_ctdbd_connection(procid_self()));
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(10, ("could not register retry with ctdb: %s\n",
                                   nt_errstr(status)));
@@ -387,7 +388,9 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
 
 #ifdef CLUSTER_SUPPORT
                if (lp_clustering()) {
-                       struct ctdbd_connection *conn = messaging_ctdbd_connection();
+                       struct ctdbd_connection *conn;
+
+                       conn = messaging_ctdbd_connection(procid_self());
 
                        r_fds = &_r_fds;
                        FD_ZERO(r_fds);
@@ -592,7 +595,7 @@ NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, const char *name)
 
 #ifdef CLUSTER_SUPPORT
        if (lp_clustering()) {
-               ctdb_unwatch(messaging_ctdbd_connection());
+               ctdb_unwatch(messaging_ctdbd_connection(procid_self()));
        }
 #endif
        return status;
index 871334649db0b753a53875244a5b3e52fc1581af..9b8fafe8d45564b426b6a5d81c0bf25c316a43b2 100644 (file)
@@ -38,7 +38,7 @@ struct messaging_ctdbd_context {
 static struct ctdbd_connection *global_ctdbd_connection;
 static int global_ctdb_connection_pid;
 
-struct ctdbd_connection *messaging_ctdbd_connection(void)
+struct ctdbd_connection *messaging_ctdbd_connection(struct server_id id)
 {
        if (global_ctdb_connection_pid == 0 &&
            global_ctdbd_connection == NULL) {
@@ -50,7 +50,7 @@ struct ctdbd_connection *messaging_ctdbd_connection(void)
                        DEBUG(0,("event_context_init failed\n"));
                }
 
-               msg = messaging_init(NULL, procid_self(), ev);
+               msg = messaging_init(NULL, id, ev);
                if (!msg) {
                        DEBUG(0,("messaging_init failed\n"));
                        return NULL;
index 2a4d0501fe0c0fc869f9b8652da47964936911b6..dc243ecf1d091cb0430fcd86cedd2ded757fb919 100644 (file)
@@ -1294,8 +1294,8 @@ bool process_exists(const struct server_id pid)
        }
 
 #ifdef CLUSTER_SUPPORT
-       return ctdbd_process_exists(messaging_ctdbd_connection(), pid.vnn,
-                                   pid.pid);
+       return ctdbd_process_exists(messaging_ctdbd_connection(procid_self()),
+                                   pid.vnn, pid.pid);
 #else
        return False;
 #endif
index b0bae927b9897b8e2b1e8d4cf104a6559b0c624b..13fec92ea5621bcda978bc70bbc3d5f8176a2f30 100644 (file)
@@ -3060,7 +3060,7 @@ void smbd_process(void)
                        NTSTATUS status;
 
                        status = ctdbd_register_ips(
-                               messaging_ctdbd_connection(),
+                               messaging_ctdbd_connection(procid_self()),
                                &srv, &clnt, release_ip, NULL);
 
                        if (!NT_STATUS_IS_OK(status)) {
index b870fa7b9dc37a281e2e720b3552ec54321bd39a..3660abb659bd0ab14f8f33627ccd41c0731e48e2 100644 (file)
@@ -690,7 +690,8 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 
 #ifdef CLUSTER_SUPPORT
        if (lp_clustering()) {
-               ctdbd_register_reconfigure(messaging_ctdbd_connection());
+               ctdbd_register_reconfigure(
+                       messaging_ctdbd_connection(procid_self()));
        }
 #endif