[prev in list] [next in list] [prev in thread] [next in thread] 

List:       samba-cvs
Subject:    [SCM] Samba Shared Repository - branch master updated
From:       vlendec () samba ! org (Volker Lendecke)
Date:       2017-09-26 11:48:02
Message-ID: 20170926114803.440851403B0 () sn ! samba ! org
[Download RAW message or body]

The branch, master has been updated
       via  61de349 lib: Use CTDB_CONTROL_CHECK_PID_SRVID
       via  f059585 lib: Add "unique_id" to ctdbd_process_exists
       via  e12ed08 ctdb: Centralize ctdb_version_string
       via  a919ded ctdbd: Fix a typo
      from  0d4c3e5 replmd: RMD_VERSION incorrectly incremented for link conflicts

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 61de349673809b17e680496b616bc432bf0823b0
Author: Volker Lendecke <vl@samba.org>
Date:   Tue Aug 29 13:31:07 2017 +0200

    lib: Use CTDB_CONTROL_CHECK_PID_SRVID
    
    Also check the unique ID for remote server ids, just like we do for
    local server ids
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13042
    Signed-off-by: Volker Lendecke <vl@samba.org>
    Reviewed-by: Amitay Isaacs <amitay@gmail.com>
    
    Autobuild-User(master): Volker Lendecke <vl@samba.org>
    Autobuild-Date(master): Tue Sep 26 13:47:31 CEST 2017 on sn-devel-144

commit f059585fe61e33ce2dd518464829c183de874d8a
Author: Volker Lendecke <vl@samba.org>
Date:   Tue Aug 29 13:26:20 2017 +0200

    lib: Add "unique_id" to ctdbd_process_exists
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13042
    Signed-off-by: Volker Lendecke <vl@samba.org>
    Reviewed-by: Amitay Isaacs <amitay@gmail.com>

commit e12ed08bd5c94f287acf0938a19a3d314624016a
Author: Volker Lendecke <vl@samba.org>
Date:   Thu Sep 21 11:51:09 2017 -0700

    ctdb: Centralize ctdb_version_string
    
    Whenever the current git hash changes, we recompile ctdb.c and
    ctdb_daemon.c. As both have quite a few warnings with -Wall, this
    makes it quite difficult to see the real warnings that pop up during
    development. Centralize the ctdb_version_string to just a single file
    without warnings.
    
    Signed-off-by: Volker Lendecke <vl@samba.org>
    Reviewed-by: Amitay Isaacs <amitay@gmail.com>

commit a919ded138a40008ac960525a753e55da3704af7
Author: Volker Lendecke <vl@samba.org>
Date:   Tue Aug 29 10:38:14 2017 +0200

    ctdbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl@samba.org>
    Reviewed-by: Amitay Isaacs <amitay@gmail.com>

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

Summary of changes:
 .../libnet/grouptest.h => ctdb/common/version.c    | 10 ++++-----
 .../libnet/grouptest.h => ctdb/common/version.h    |  8 +++-----
 ctdb/server/ctdb_daemon.c                          |  6 +++---
 ctdb/tools/ctdb.c                                  |  4 ++--
 ctdb/wscript                                       |  2 +-
 source3/include/ctdbd_conn.h                       |  2 +-
 source3/lib/ctdb_dummy.c                           |  3 ++-
 source3/lib/ctdbd_conn.c                           | 24 ++++++++++++++++++----
 source3/lib/serverid.c                             |  2 +-
 9 files changed, 38 insertions(+), 23 deletions(-)
 copy source4/torture/libnet/grouptest.h => ctdb/common/version.c (75%)
 copy source4/torture/libnet/grouptest.h => ctdb/common/version.h (75%)


Changeset truncated at 500 lines:

diff --git a/source4/torture/libnet/grouptest.h b/ctdb/common/version.c
similarity index 75%
copy from source4/torture/libnet/grouptest.h
copy to ctdb/common/version.c
index 8b65e6e..e34e98c 100644
--- a/source4/torture/libnet/grouptest.h
+++ b/ctdb/common/version.c
@@ -1,7 +1,5 @@
 /*
-   Unix SMB/CIFS implementation.
-
-   Copyright (C) Rafal Szczesniak 2007
+   CTDB version string
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -14,7 +12,9 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#define TEST_GROUPNAME  "libnetgrptest"
+#include "ctdb_version.h"
+
+const char ctdb_version_string[] = CTDB_VERSION_STRING;
diff --git a/source4/torture/libnet/grouptest.h b/ctdb/common/version.h
similarity index 75%
copy from source4/torture/libnet/grouptest.h
copy to ctdb/common/version.h
index 8b65e6e..1cf1c5d 100644
--- a/source4/torture/libnet/grouptest.h
+++ b/ctdb/common/version.h
@@ -1,7 +1,5 @@
 /*
-   Unix SMB/CIFS implementation.
-
-   Copyright (C) Rafal Szczesniak 2007
+   CTDB version string
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -14,7 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+   along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#define TEST_GROUPNAME  "libnetgrptest"
+extern const char ctdb_version_string[];
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index c72f41a..185982e 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -36,7 +36,7 @@
 #include "lib/util/blocking.h"
 #include "lib/util/become_daemon.h"
 
-#include "ctdb_version.h"
+#include "common/version.h"
 #include "ctdb_private.h"
 #include "ctdb_client.h"
 
@@ -1206,7 +1206,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
 
 	ctdb->ctdbd_pid = getpid();
 	DEBUG(DEBUG_ERR, ("Starting CTDBD (Version %s) as PID: %u\n",
-			  CTDB_VERSION_STRING, ctdb->ctdbd_pid));
+			  ctdb_version_string, ctdb->ctdbd_pid));
 	ctdb_create_pidfile(ctdb);
 
 	/* create a unix domain stream socket to listen to */
@@ -1744,7 +1744,7 @@ struct ctdb_client *ctdb_find_client_by_pid(struct ctdb_context *ctdb, pid_t pid
 /* This control is used by samba when probing if a process (of a samba daemon)
    exists on the node.
    Samba does this when it needs/wants to check if a subrecord in one of the
-   databases is still valied, or if it is stale and can be removed.
+   databases is still valid, or if it is stale and can be removed.
    If the node is in unhealthy or stopped state we just kill of the samba
    process holding this sub-record and return to the calling samba that
    the process does not exist.
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index f8f9a18..a135da2 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -30,7 +30,7 @@
 #include <tevent.h>
 #include <tdb.h>
 
-#include "ctdb_version.h"
+#include "common/version.h"
 #include "lib/util/debug.h"
 #include "lib/util/samba_util.h"
 #include "lib/util/sys_rw.h"
@@ -725,7 +725,7 @@ static int run_helper(TALLOC_CTX *mem_ctx, const char *command,
 static int control_version(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
 			   int argc, const char **argv)
 {
-	printf("%s\n", CTDB_VERSION_STRING);
+	printf("%s\n", ctdb_version_string);
 	return 0;
 }
 
diff --git a/ctdb/wscript b/ctdb/wscript
index 2679c56..0523bde 100644
--- a/ctdb/wscript
+++ b/ctdb/wscript
@@ -386,7 +386,7 @@ def build(bld):
                                              logging.c rb_tree.c tunable.c
                                              pidfile.c run_proc.c
                                              hash_count.c run_event.c
-                                             sock_client.c'''),
+                                             sock_client.c version.c'''),
                         deps='''samba-util sys_rw tevent-util
                                 replace talloc tevent tdb''')
 
diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h
index 4e7c1b0..f6040ad 100644
--- a/source3/include/ctdbd_conn.h
+++ b/source3/include/ctdbd_conn.h
@@ -50,7 +50,7 @@ int ctdbd_messaging_send_iov(struct ctdbd_connection *conn,
 			     const struct iovec *iov, int iovlen);
 
 bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn,
-			  pid_t pid);
+			  pid_t pid, uint64_t unique_id);
 
 char *ctdbd_dbpath(struct ctdbd_connection *conn,
 		   TALLOC_CTX *mem_ctx, uint32_t db_id);
diff --git a/source3/lib/ctdb_dummy.c b/source3/lib/ctdb_dummy.c
index 8a06b0c..144c850 100644
--- a/source3/lib/ctdb_dummy.c
+++ b/source3/lib/ctdb_dummy.c
@@ -62,7 +62,8 @@ int ctdbd_register_ips(struct ctdbd_connection *conn,
 	return ENOSYS;
 }
 
-bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn, pid_t pid)
+bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn,
+			  pid_t pid, uint64_t unique_id)
 {
 	return false;
 }
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index bab489e..521e016 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -781,14 +781,30 @@ static int ctdbd_control(struct ctdbd_connection *conn,
 /*
  * see if a remote process exists
  */
-bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn, pid_t pid)
+bool ctdbd_process_exists(struct ctdbd_connection *conn, uint32_t vnn,
+			  pid_t pid, uint64_t unique_id)
 {
+	uint8_t buf[sizeof(pid)+sizeof(unique_id)];
 	int32_t cstatus = 0;
 	int ret;
 
-	ret = ctdbd_control(conn, vnn, CTDB_CONTROL_PROCESS_EXISTS, 0, 0,
-			    (TDB_DATA) { .dptr = (uint8_t *)&pid,
-					 .dsize = sizeof(pid) },
+	if (unique_id == SERVERID_UNIQUE_ID_NOT_TO_VERIFY) {
+		ret = ctdbd_control(conn, vnn, CTDB_CONTROL_PROCESS_EXISTS,
+				    0, 0,
+				    (TDB_DATA) { .dptr = (uint8_t *)&pid,
+						    .dsize = sizeof(pid) },
+				    NULL, NULL, &cstatus);
+		if (ret != 0) {
+			return false;
+		}
+		return (cstatus == 0);
+	}
+
+	memcpy(buf, &pid, sizeof(pid));
+	memcpy(buf+sizeof(pid), &unique_id, sizeof(unique_id));
+
+	ret = ctdbd_control(conn, vnn, CTDB_CONTROL_CHECK_PID_SRVID, 0, 0,
+			    (TDB_DATA) { .dptr = buf, .dsize = sizeof(buf) },
 			    NULL, NULL, &cstatus);
 	if (ret != 0) {
 		return false;
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index ca4bb27..7300448 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -199,7 +199,7 @@ bool serverid_exists(const struct server_id *id)
 
 	if (lp_clustering()) {
 		return ctdbd_process_exists(messaging_ctdb_connection(),
-					    id->vnn, id->pid);
+					    id->vnn, id->pid, id->unique_id);
 	}
 
 	return false;


-- 
Samba Shared Repository

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic