s3: messaging_ctdbd_connection() was only called with procid_self()
authorVolker Lendecke <vl@samba.org>
Tue, 31 Aug 2010 14:52:56 +0000 (16:52 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 31 Aug 2010 15:07:41 +0000 (17:07 +0200)
Eventually we'll get this right...

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 a64469e0690ee4cdecd842f474d9859cb88da15f..bf5e5de26c3a3028762dc9fe1d9b1424dec5d361 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(struct server_id id);
+struct ctdbd_connection *messaging_ctdbd_connection(void);
 
 bool message_send_all(struct messaging_context *msg_ctx,
                      int msg_type,
index ceaadd225697418273e6914811190fc88a68c7dd..67425dcb7901b9004474d23a415ce69b88f9649e 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(procid_self()),
+       rets = ctdbd_control_local(messaging_ctdbd_connection(),
                                   CTDB_CONTROL_TRANS3_COMMIT,
                                   h->ctx->db_id, 0,
                                   db_ctdb_marshall_finish(h->m_write),
@@ -1005,9 +1005,8 @@ again:
                           ((struct ctdb_ltdb_header *)ctdb_data.dptr)->dmaster : -1,
                           get_my_vnn()));
 
-               status = ctdbd_migrate(
-                       messaging_ctdbd_connection(procid_self()), ctx->db_id,
-                       key);
+               status = ctdbd_migrate(messaging_ctdbd_connection(), ctx->db_id,
+                                      key);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(5, ("ctdb_migrate failed: %s\n",
                                  nt_errstr(status)));
@@ -1112,8 +1111,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(procid_self()),
-                            ctx->db_id, key, mem_ctx, data);
+       status = ctdbd_fetch(messaging_ctdbd_connection(), 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;
@@ -1291,7 +1290,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
        db_ctdb->transaction = NULL;
        db_ctdb->db = result;
 
-       conn = messaging_ctdbd_connection(procid_self());
+       conn = messaging_ctdbd_connection();
        if (conn == NULL) {
                DEBUG(1, ("Could not connect to ctdb\n"));
                TALLOC_FREE(result);
index 42bf3b091624173e92ffeb1ab063f34aa12718fd..6e4c6d796c7b49eada633d325e7b8b56d5e727c3 100644 (file)
@@ -312,8 +312,7 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
 
 #ifdef CLUSTER_SUPPORT
        if (lp_clustering()) {
-               struct server_id my_id = messaging_server_id(ctx->msg);
-               status = ctdb_watch_us(messaging_ctdbd_connection(my_id));
+               status = ctdb_watch_us(messaging_ctdbd_connection());
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(10, ("could not register retry with ctdb: %s\n",
                                   nt_errstr(status)));
@@ -388,11 +387,8 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
 
 #ifdef CLUSTER_SUPPORT
                if (lp_clustering()) {
-                       struct server_id my_id;
                        struct ctdbd_connection *conn;
-
-                       my_id = messaging_server_id(ctx->msg);
-                       conn = messaging_ctdbd_connection(my_id);
+                       conn = messaging_ctdbd_connection();
 
                        r_fds = &_r_fds;
                        FD_ZERO(r_fds);
@@ -597,8 +593,7 @@ NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, const char *name)
 
 #ifdef CLUSTER_SUPPORT
        if (lp_clustering()) {
-               struct server_id my_id = messaging_server_id(ctx->msg);
-               ctdb_unwatch(messaging_ctdbd_connection(my_id));
+               ctdb_unwatch(messaging_ctdbd_connection());
        }
 #endif
        return status;
index 9b8fafe8d45564b426b6a5d81c0bf25c316a43b2..871334649db0b753a53875244a5b3e52fc1581af 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(struct server_id id)
+struct ctdbd_connection *messaging_ctdbd_connection(void)
 {
        if (global_ctdb_connection_pid == 0 &&
            global_ctdbd_connection == NULL) {
@@ -50,7 +50,7 @@ struct ctdbd_connection *messaging_ctdbd_connection(struct server_id id)
                        DEBUG(0,("event_context_init failed\n"));
                }
 
-               msg = messaging_init(NULL, id, ev);
+               msg = messaging_init(NULL, procid_self(), ev);
                if (!msg) {
                        DEBUG(0,("messaging_init failed\n"));
                        return NULL;
index 644f1830c6f12c13880d5c301b5ed750c9bad8e0..315f3897d6f5f2eef248f274125add4933aa7b9e 100644 (file)
@@ -1296,7 +1296,7 @@ bool process_exists(const struct server_id pid)
        }
 
 #ifdef CLUSTER_SUPPORT
-       return ctdbd_process_exists(messaging_ctdbd_connection(procid_self()),
+       return ctdbd_process_exists(messaging_ctdbd_connection(),
                                    pid.vnn, pid.pid);
 #else
        return False;
index 6beed4fb3fc9cea7b16c080d9b8065987d46f91c..4d34bcf8581a911e4d3701fb605276aa93b6dcdf 100644 (file)
@@ -2899,7 +2899,7 @@ static NTSTATUS smbd_register_ips(struct smbd_server_connection *sconn,
        char tmp_addr[INET6_ADDRSTRLEN];
        char *addr;
 
-       cconn = messaging_ctdbd_connection(procid_self());
+       cconn = messaging_ctdbd_connection();
        if (cconn == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
index aa0f7e85abe40be38644dc8311ff0165c7d0426d..c9ae742b990bf489e0a3b466e8c0ad65b0b97381 100644 (file)
@@ -729,8 +729,7 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
 
 #ifdef CLUSTER_SUPPORT
        if (lp_clustering()) {
-               ctdbd_register_reconfigure(
-                       messaging_ctdbd_connection(procid_self()));
+               ctdbd_register_reconfigure(messaging_ctdbd_connection());
        }
 #endif