[SCM] Samba Shared Repository - branch v3-6-test updated

Volker Lendecke vlendec at samba.org
Tue Aug 31 09:31:17 MDT 2010


The branch, v3-6-test has been updated
       via  958fb53 s3: messaging_ctdbd_connection() was only called with procid_self()
       via  91b3df1 s3: messaging_ctdbd_init potentially modifies my_vnn
       via  48fa585 s3: Make ctdbd_init_connection static
      from  fe6f72a packaging: build fixes

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 958fb53833673527dc36cd52511386ae9debb542
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 31 16:52:56 2010 +0200

    s3: messaging_ctdbd_connection() was only called with procid_self()
    
    Eventually we'll get this right...

commit 91b3df111827ef5f2ef89f02318a0fbfacd1a3fa
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 31 16:51:28 2010 +0200

    s3: messaging_ctdbd_init potentially modifies my_vnn
    
    If we call messaging_ctdbd_connection() we end up with the wrong vnn in our
    messaging context.
    
    This is a bit of a hack, get_my_vnn() needs to go eventually along with
    procid_self()

commit 48fa585249f160cdc2bd7b69d3cb914f7982cfb1
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Aug 31 16:11:10 2010 +0200

    s3: Make ctdbd_init_connection static

-----------------------------------------------------------------------

Summary of changes:
 source3/include/ctdbd_conn.h |    2 --
 source3/include/messages.h   |    2 +-
 source3/lib/ctdbd_conn.c     |    4 ++--
 source3/lib/dbwrap_ctdb.c    |   13 ++++++-------
 source3/lib/g_lock.c         |    8 +++-----
 source3/lib/messages.c       |    1 +
 source3/lib/messages_ctdbd.c |    4 ++--
 source3/lib/util.c           |    2 +-
 source3/smbd/process.c       |    2 +-
 source3/smbd/server.c        |    3 +--
 10 files changed, 18 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h
index c5ba572..80cf717 100644
--- a/source3/include/ctdbd_conn.h
+++ b/source3/include/ctdbd_conn.h
@@ -22,8 +22,6 @@
 
 struct ctdbd_connection;
 
-NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
-			       struct ctdbd_connection **pconn);
 NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
 				    struct ctdbd_connection **pconn);
 
diff --git a/source3/include/messages.h b/source3/include/messages.h
index a64469e..bf5e5de 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -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,
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 8dba3b2..afc13f2 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -433,8 +433,8 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32 reqid,
  * Get us a ctdbd connection
  */
 
-NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
-			       struct ctdbd_connection **pconn)
+static NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx,
+				      struct ctdbd_connection **pconn)
 {
 	struct ctdbd_connection *conn;
 	NTSTATUS status;
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index ceaadd2..67425dc 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -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);
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index 49f719b..3c600d2 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -312,8 +312,7 @@ 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(procid_self()));
+		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)));
@@ -389,8 +388,7 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name,
 #ifdef CLUSTER_SUPPORT
 		if (lp_clustering()) {
 			struct ctdbd_connection *conn;
-
-			conn = messaging_ctdbd_connection(procid_self());
+			conn = messaging_ctdbd_connection();
 
 			r_fds = &_r_fds;
 			FD_ZERO(r_fds);
@@ -595,7 +593,7 @@ NTSTATUS g_lock_unlock(struct g_lock_ctx *ctx, const char *name)
 
 #ifdef CLUSTER_SUPPORT
 	if (lp_clustering()) {
-		ctdb_unwatch(messaging_ctdbd_connection(procid_self()));
+		ctdb_unwatch(messaging_ctdbd_connection());
 	}
 #endif
 	return status;
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index ba0cd80..a8122ce 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -210,6 +210,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
 			return NULL;
 		}
 	}
+	ctx->id.vnn = get_my_vnn();
 #endif
 
 	messaging_register(ctx, NULL, MSG_PING, ping_message);
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index 9b8fafe..8713346 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -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;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 8bea36b..fd7cdca 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -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;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 73caa5f..711bbf4 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -3073,7 +3073,7 @@ void smbd_process(void)
 			NTSTATUS status;
 
 			status = ctdbd_register_ips(
-				messaging_ctdbd_connection(procid_self()),
+				messaging_ctdbd_connection(),
 				&srv, &clnt, release_ip, NULL);
 
 			if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 82f2f48..091e9da 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -692,8 +692,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
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list