[SCM] Samba Shared Repository - branch v4-12-test updated

Karolin Seeger kseeger at samba.org
Tue Aug 25 12:53:02 UTC 2020


The branch, v4-12-test has been updated
       via  4955925e912 ctdb-recoverd: Rename update_local_flags() -> update_flags()
       via  087f8868209 ctdb-recoverd: Change update_local_flags() to use already retrieved nodemaps
       via  99441077417 ctdb-recoverd: Get remote nodemaps earlier
       via  4820778cfbe ctdb-recoverd: Do not fetch the nodemap from the recovery master
       via  4c5fde56c30 ctdb-recoverd: Change get_remote_nodemaps() to use connected nodes
       via  4aae8adc718 ctdb-recoverd: Fix node_pnn check and assignment of nodemap into array
       via  ad9780853ed ctdb-recoverd: Add fail callback to assign banning credits
       via  db34c22ab12 ctdb-recoverd: Add an intermediate state struct for nodemap fetching
       via  d360401282d ctdb-recoverd: Move memory allocation into get_remote_nodemaps()
       via  bedd92b813c ctdb-recoverd: Change signature of get_remote_nodemaps()
       via  3b35541c13d ctdb-recoverd: Fix a local memory leak
       via  828807f52d3 ctdb-recoverd: Basic cleanups for get_remote_nodemaps()
       via  5f0f32ab639 ctdb-recoverd: Simplify calculation of new flags
       via  442d6b0b66e ctdb-recoverd: Correctly find nodemap entry for pnn
       via  b3a3eeb4ba8 ctdb-recoverd: Do not retrieve nodemap from recovery master
       via  fc489e5deaf ctdb-recoverd: Flatten update_flags_on_all_nodes()
       via  32dfcdb1bc4 ctdb-recoverd: Move ctdb_ctrl_modflags() to ctdb_recoverd.c
       via  ba505c32e96 ctdb-recoverd: Improve a call to update_flags_on_all_nodes()
       via  90db66414a0 ctdb-recoverd: Use update_flags_on_all_nodes()
       via  f96017bddcc ctdb-recoverd: Introduce some local variables to improve readability
       via  e22268a7d7d ctdb-recoverd: Change update_flags_on_all_nodes() to take rec argument
       via  878c3b49f62 ctdb-recoverd: Drop unused nodemap argument from update_flags_on_all_nodes()
       via  debb98b55a2 docs: Add missing winexe manpage
      from  492213aff41 util: Add cmocka unit test for directory_create_or_exists

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-12-test


- Log -----------------------------------------------------------------
commit 4955925e9125a9a16f588feb94cac9d033037ce8
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jan 24 10:21:37 2018 +1100

    ctdb-recoverd: Rename update_local_flags() -> update_flags()
    
    This also updates remote flags so the name is misleading.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 4aa8e72d60e92951b35190d2ffcfdb1bfb756609)
    
    Autobuild-User(v4-12-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-12-test): Tue Aug 25 12:52:45 UTC 2020 on sn-devel-184

commit 087f88682099f4b936094bc678f24a4113d1190d
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jan 18 20:35:55 2018 +1100

    ctdb-recoverd: Change update_local_flags() to use already retrieved nodemaps
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 702c7c4934e79a9161fdc59df70df30ae492d89f)

commit 99441077417bda37872d7999ad0cd603797ab01b
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jun 14 03:51:01 2019 +1000

    ctdb-recoverd: Get remote nodemaps earlier
    
    update_local_flags() will be changed to use these nodemaps.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 910a0b3b747a987ba69b6a0b6256e964b7d85dfe)

commit 4820778cfbe1c9077818bd9f6ab507d76157a0ad
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Jun 14 00:23:22 2019 +1000

    ctdb-recoverd: Do not fetch the nodemap from the recovery master
    
    The nodemap has already been fetched from the local node and is
    actually passed to this function.  Care must be taken to avoid
    referencing the "remote" nodemap for the recovery master.  It also
    isn't useful to do so, since it would be the same nodemap.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit d50919b0cb28f299c9b6985271b29d4f27c5f619)

commit 4c5fde56c309db48a8d6e535564b8effb012c6a9
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jan 18 20:02:42 2018 +1100

    ctdb-recoverd: Change get_remote_nodemaps() to use connected nodes
    
    The plan here is to use the nodemaps retrieved by get_remote_nodes()
    in update_local_flags().  This will improve efficiency, since
    get_remote_nodes() fetches flags from nodes in parallel.  It also
    means that get_remote_nodes() can be used exactly once early on in
    main_loop() to retrieve remote nodemaps.  Retrieving nodemaps multiple
    times is unnecessary and racy - a single monitoring iteration should
    not fetch flags multiple times and compare them.
    
    This introduces a temporary behaviour change but it will be of no
    consequence when the above changes are made.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 762d1d8a9605f97973a2c1176de5d29fcc61d15a)

commit 4aae8adc7182687db73c2e40b4a8a24ce5053d16
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jul 30 11:57:51 2020 +1000

    ctdb-recoverd: Fix node_pnn check and assignment of nodemap into array
    
    This array is indexed by the same index as nodemap, not the PNN.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 368c83bfe3bbfff568d14f65e7b1ffa41d5349ac)

commit ad9780853ed3a18993fa0935ea4551716030b8e2
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jan 18 19:58:15 2018 +1100

    ctdb-recoverd: Add fail callback to assign banning credits
    
    Also drop error handling in main_loop() that is replaced by this
    change.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 10ce0dbf1c11eaaab7b28b6bbd014235a36d1962)

commit db34c22ab12e3abc8e29029205ffd8940577f9bd
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jan 18 19:52:22 2018 +1100

    ctdb-recoverd: Add an intermediate state struct for nodemap fetching
    
    This will allow an error callback to be added.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit a079ee31690cf7110f46b41989ffcfb83b7626d6)

commit d360401282d4127b466c79cf024d4c02cd70921f
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jan 18 16:31:39 2018 +1100

    ctdb-recoverd: Move memory allocation into get_remote_nodemaps()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 2eaa0af6160588b6e3364b181d0976477d12b51b)

commit bedd92b813c1c30d79f8c16454de12aa1241c845
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jan 18 16:41:19 2018 +1100

    ctdb-recoverd: Change signature of get_remote_nodemaps()
    
    Change 1st argument to a rec context, since this will be needed later.
    Drop the nodemap argument and access it via rec->nodemap instead.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 3324dd272c7dafa92cd9c3fd0af8f50084bcdaaa)

commit 3b35541c13d9843035ba4bc4bd00aa58b488ba40
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 17 20:27:18 2020 +1000

    ctdb-recoverd: Fix a local memory leak
    
    The memory is allocated off the memory context used by the current
    iteration of main loop.  It is freed when main loop completes the fix
    doesn't require backporting to stable branches.  However, it is sloppy
    so it is worth fixing.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit d2d90f250214582d7124b8137aa2cf5032b2f285)

commit 828807f52d37ec0d4bc5ba798b4c01b4ef84071d
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jan 18 16:19:36 2018 +1100

    ctdb-recoverd: Basic cleanups for get_remote_nodemaps()
    
    Don't log an error on failure - let the caller can do this.  Apart
    from this: fix up coding style and modernise the remaining error
    message.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 52f520d39cd92e1cf2413fd7e0dd362debd6f463)

commit 5f0f32ab639e15752eca79463d8d7bccaf08222c
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 14 14:29:09 2020 +1000

    ctdb-recoverd: Simplify calculation of new flags
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Fri Jul 24 06:03:23 UTC 2020 on sn-devel-184
    
    (cherry picked from commit 5ce6133a75107abdcb9fcfd93bc7594812dc5055)

commit 442d6b0b66e839ea4240fadb8a1dbc348cfb123d
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 14 14:22:15 2020 +1000

    ctdb-recoverd: Correctly find nodemap entry for pnn
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 3654e416770cc7521dcc3c15976daeba37023304)

commit b3a3eeb4ba875c3d3f232bc37babe85dc44b854a
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 5 23:49:05 2020 +1000

    ctdb-recoverd: Do not retrieve nodemap from recovery master
    
    It is already in rec->nodemap.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 9475ab044161e687b9ced3a477746393565b49b1)

commit fc489e5deafd705a39f8304c319a4c247ab8d281
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Sep 28 10:46:17 2018 +1000

    ctdb-recoverd: Flatten update_flags_on_all_nodes()
    
    The logic currently in ctdb_ctrl_modflags() will be optimised so that
    it no longer matches the pattern for a control function.  So, remove
    this function and squash its functionality into the only caller.
    
    Although there are some superficial changes, the behaviour is
    unchanged.
    
    Flattening the 2 functions produces some seriously weird logic for
    setting the new flags, to the point where using ctdb_ctrl_modflags()
    for this purpose now looks very strange.  The weirdness will be
    cleaned up in a subsequent commit.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 0c6a7db3ba84b8355359b0a8c52690b234bb866d)

commit 32dfcdb1bc43139248d899f0f7f9c7499dac5b75
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 5 23:37:57 2020 +1000

    ctdb-recoverd: Move ctdb_ctrl_modflags() to ctdb_recoverd.c
    
    This file is the only user of this function.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit a88c10c5a9afcf0a3dcadef07dd95af498bfa47a)

commit ba505c32e9682077d4901785a1c2404f8ccb28cf
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jul 14 14:43:04 2020 +1000

    ctdb-recoverd: Improve a call to update_flags_on_all_nodes()
    
    This should take a PNN, not an array index.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit b1e631ff929fd87392a80895d1c8d265d9df42dc)

commit 90db66414a04e3f168aaca718c436e7adce5285c
Author: Martin Schwenke <martin at meltin.net>
Date:   Sat Jun 15 07:20:19 2019 +1000

    ctdb-recoverd: Use update_flags_on_all_nodes()
    
    This is clearer than using the MODFLAGS control directly.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 915d24ac12d27c21649d9e64d201d9df9d583129)

commit f96017bddcc9733db299555e5a4d891b511299f2
Author: Martin Schwenke <martin at meltin.net>
Date:   Sat Jun 15 07:19:26 2019 +1000

    ctdb-recoverd: Introduce some local variables to improve readability
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit f681c0e947741151f8fb95d88edddfd732166dc1)

commit e22268a7d7dcdd61ad5667f25fbbb0b976bf6296
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 5 23:45:15 2020 +1000

    ctdb-recoverd: Change update_flags_on_all_nodes() to take rec argument
    
    This makes fields such as recmaster and nodemap easily available if
    required.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit cb3a3147b7a3a29d7806733791e1fa6ba2e46680)

commit 878c3b49f62b539ac0daed0006ef6ac609d895f8
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jan 18 20:25:07 2018 +1100

    ctdb-recoverd: Drop unused nodemap argument from update_flags_on_all_nodes()
    
    An unused argument needlessly extends the length of function calls.  A
    subsequent change will allow rec->nodemap to be used if necessary.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit 6982fcb3e6c940d0047aac3b6bfbc9dfdc8d7214)

commit debb98b55a2385829f0333cf7f9f16f108f08cfe
Author: Günther Deschner <gd at samba.org>
Date:   Tue Mar 10 18:18:10 2020 +0100

    docs: Add missing winexe manpage
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14318
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Thu Aug 20 12:55:23 UTC 2020 on sn-devel-184
    
    (cherry picked from commit a9b6a8378e5db19d5d5ecd42f08ec3abd49ad5b8)

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

Summary of changes:
 ctdb/include/ctdb_client.h     |   5 -
 ctdb/server/ctdb_client.c      |  65 ----------
 ctdb/server/ctdb_recoverd.c    | 264 ++++++++++++++++++++++++++++-------------
 docs-xml/manpages/winexe.1.xml | 184 ++++++++++++++++++++++++++++
 docs-xml/wscript_build         |   5 +
 5 files changed, 371 insertions(+), 152 deletions(-)
 create mode 100644 docs-xml/manpages/winexe.1.xml


Changeset truncated at 500 lines:

diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h
index 198a8a38dbb..b89c4e49b2f 100644
--- a/ctdb/include/ctdb_client.h
+++ b/ctdb/include/ctdb_client.h
@@ -195,11 +195,6 @@ int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
 			 TALLOC_CTX *mem_ctx,
 			 struct ctdb_iface_list_old **ifaces);
 
-int ctdb_ctrl_modflags(struct ctdb_context *ctdb,
-		       struct timeval timeout,
-		       uint32_t destnode,
-		       uint32_t set, uint32_t clear);
-
 int ctdb_ctrl_get_all_tunables(struct ctdb_context *ctdb,
 			       struct timeval timeout, uint32_t destnode,
 			       struct ctdb_tunable_list *tunables);
diff --git a/ctdb/server/ctdb_client.c b/ctdb/server/ctdb_client.c
index 453e7b28477..5d1a30d03da 100644
--- a/ctdb/server/ctdb_client.c
+++ b/ctdb/server/ctdb_client.c
@@ -1243,71 +1243,6 @@ int ctdb_ctrl_get_ifaces(struct ctdb_context *ctdb,
 	return 0;
 }
 
-/*
-  set/clear the permanent disabled bit on a remote node
- */
-int ctdb_ctrl_modflags(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode,
-		       uint32_t set, uint32_t clear)
-{
-	int ret;
-	TDB_DATA data;
-	struct ctdb_node_map_old *nodemap=NULL;
-	struct ctdb_node_flag_change c;
-	TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
-	uint32_t recmaster;
-	uint32_t *nodes;
-
-
-	/* find the recovery master */
-	ret = ctdb_ctrl_getrecmaster(ctdb, tmp_ctx, timeout, CTDB_CURRENT_NODE, &recmaster);
-	if (ret != 0) {
-		DEBUG(DEBUG_ERR, (__location__ " Unable to get recmaster from local node\n"));
-		talloc_free(tmp_ctx);
-		return ret;
-	}
-
-
-	/* read the node flags from the recmaster */
-	ret = ctdb_ctrl_getnodemap(ctdb, timeout, recmaster, tmp_ctx, &nodemap);
-	if (ret != 0) {
-		DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from node %u\n", destnode));
-		talloc_free(tmp_ctx);
-		return -1;
-	}
-	if (destnode >= nodemap->num) {
-		DEBUG(DEBUG_ERR,(__location__ " Nodemap from recmaster does not contain node %d\n", destnode));
-		talloc_free(tmp_ctx);
-		return -1;
-	}
-
-	c.pnn       = destnode;
-	c.old_flags = nodemap->nodes[destnode].flags;
-	c.new_flags = c.old_flags;
-	c.new_flags |= set;
-	c.new_flags &= ~clear;
-
-	data.dsize = sizeof(c);
-	data.dptr = (unsigned char *)&c;
-
-	/* send the flags update to all connected nodes */
-	nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
-
-	if (ctdb_client_async_control(ctdb, CTDB_CONTROL_MODIFY_FLAGS,
-					nodes, 0,
-					timeout, false, data,
-					NULL, NULL,
-					NULL) != 0) {
-		DEBUG(DEBUG_ERR, (__location__ " Unable to update nodeflags on remote nodes\n"));
-
-		talloc_free(tmp_ctx);
-		return -1;
-	}
-
-	talloc_free(tmp_ctx);
-	return 0;
-}
-
-
 /*
   get all tunables
  */
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 3f5d43c1e87..f825427e7a3 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -425,18 +425,62 @@ static int set_recovery_mode(struct ctdb_context *ctdb,
 }
 
 /*
-  update flags on all active nodes
+ * Update flags on all connected nodes
  */
-static int update_flags_on_all_nodes(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodemap, uint32_t pnn, uint32_t flags)
+static int update_flags_on_all_nodes(struct ctdb_recoverd *rec,
+				     uint32_t pnn,
+				     uint32_t flags)
 {
+	struct ctdb_context *ctdb = rec->ctdb;
+	struct timeval timeout = CONTROL_TIMEOUT();
+	TDB_DATA data;
+	struct ctdb_node_map_old *nodemap=NULL;
+	struct ctdb_node_flag_change c;
+	TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+	uint32_t *nodes;
+	uint32_t i;
 	int ret;
 
-	ret = ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), pnn, flags, ~flags);
-		if (ret != 0) {
-		DEBUG(DEBUG_ERR, (__location__ " Unable to update nodeflags on remote nodes\n"));
+	nodemap = rec->nodemap;
+
+	for (i = 0; i < nodemap->num; i++) {
+		if (pnn == nodemap->nodes[i].pnn) {
+			break;
+		}
+	}
+	if (i >= nodemap->num) {
+		DBG_ERR("Nodemap does not contain node %d\n", pnn);
+		talloc_free(tmp_ctx);
 		return -1;
 	}
 
+	c.pnn       = pnn;
+	c.old_flags = nodemap->nodes[i].flags;
+	c.new_flags = flags;
+
+	data.dsize = sizeof(c);
+	data.dptr = (unsigned char *)&c;
+
+	/* send the flags update to all connected nodes */
+	nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
+
+	ret = ctdb_client_async_control(ctdb,
+					CTDB_CONTROL_MODIFY_FLAGS,
+					nodes,
+					0,
+					timeout,
+					false,
+					data,
+					NULL,
+					NULL,
+					NULL);
+	if (ret != 0) {
+		DBG_ERR("Unable to update flags on remote nodes\n");
+		talloc_free(tmp_ctx);
+		return -1;
+	}
+
+	talloc_free(tmp_ctx);
 	return 0;
 }
 
@@ -493,60 +537,57 @@ static void ctdb_wait_election(struct ctdb_recoverd *rec)
 }
 
 /*
-  Update our local flags from all remote connected nodes. 
-  This is only run when we are or we belive we are the recovery master
+ * Update local flags from all remote connected nodes and push out
+ * flags changes to all nodes.  This is only run by the recovery
+ * master.
  */
-static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map_old *nodemap)
+static int update_flags(struct ctdb_recoverd *rec,
+			struct ctdb_node_map_old *nodemap,
+			struct ctdb_node_map_old **remote_nodemaps)
 {
 	unsigned int j;
 	struct ctdb_context *ctdb = rec->ctdb;
 	TALLOC_CTX *mem_ctx = talloc_new(ctdb);
 
-	/* get the nodemap for all active remote nodes and verify
-	   they are the same as for this node
-	 */
+	/* Check flags from remote nodes */
 	for (j=0; j<nodemap->num; j++) {
 		struct ctdb_node_map_old *remote_nodemap=NULL;
+		uint32_t local_flags = nodemap->nodes[j].flags;
+		uint32_t remote_flags;
 		int ret;
 
-		if (nodemap->nodes[j].flags & NODE_FLAGS_DISCONNECTED) {
+		if (local_flags & NODE_FLAGS_DISCONNECTED) {
 			continue;
 		}
 		if (nodemap->nodes[j].pnn == ctdb->pnn) {
 			continue;
 		}
 
-		ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
-					   mem_ctx, &remote_nodemap);
-		if (ret != 0) {
-			DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from remote node %u\n", 
-				  nodemap->nodes[j].pnn));
-			ctdb_set_culprit(rec, nodemap->nodes[j].pnn);
-			talloc_free(mem_ctx);
-			return -1;
-		}
-		if (nodemap->nodes[j].flags != remote_nodemap->nodes[j].flags) {
-			/* We should tell our daemon about this so it
-			   updates its flags or else we will log the same 
-			   message again in the next iteration of recovery.
-			   Since we are the recovery master we can just as
-			   well update the flags on all nodes.
-			*/
-			ret = ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, remote_nodemap->nodes[j].flags, ~remote_nodemap->nodes[j].flags);
+		remote_nodemap = remote_nodemaps[j];
+		remote_flags = remote_nodemap->nodes[j].flags;
+
+		if (local_flags != remote_flags) {
+			ret = update_flags_on_all_nodes(rec,
+							nodemap->nodes[j].pnn,
+							remote_flags);
 			if (ret != 0) {
-				DEBUG(DEBUG_ERR, (__location__ " Unable to update nodeflags on remote nodes\n"));
+				DBG_ERR(
+				    "Unable to update flags on remote nodes\n");
+				talloc_free(mem_ctx);
 				return -1;
 			}
 
-			/* Update our local copy of the flags in the recovery
-			   daemon.
-			*/
-			DEBUG(DEBUG_NOTICE,("Remote node %u had flags 0x%x, local had 0x%x - updating local\n",
-				 nodemap->nodes[j].pnn, remote_nodemap->nodes[j].flags,
-				 nodemap->nodes[j].flags));
-			nodemap->nodes[j].flags = remote_nodemap->nodes[j].flags;
+			/*
+			 * Update the local copy of the flags in the
+			 * recovery daemon.
+			 */
+			D_NOTICE("Remote node %u had flags 0x%x, "
+				 "local had 0x%x - updating local\n",
+				 nodemap->nodes[j].pnn,
+				 remote_flags,
+				 local_flags);
+			nodemap->nodes[j].flags = remote_flags;
 		}
-		talloc_free(remote_nodemap);
 	}
 	talloc_free(mem_ctx);
 	return 0;
@@ -1125,7 +1166,9 @@ static int do_recovery(struct ctdb_recoverd *rec,
 			continue;
 		}
 
-		ret = update_flags_on_all_nodes(ctdb, nodemap, i, nodemap->nodes[i].flags);
+		ret = update_flags_on_all_nodes(rec,
+						nodemap->nodes[i].pnn,
+						nodemap->nodes[i].flags);
 		if (ret != 0) {
 			if (nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE) {
 				DEBUG(DEBUG_WARNING, (__location__ "Unable to update flags on inactive node %d\n", i));
@@ -2172,37 +2215,94 @@ done:
 }
 
 
-static void async_getnodemap_callback(struct ctdb_context *ctdb, uint32_t node_pnn, int32_t res, TDB_DATA outdata, void *callback_data)
+struct remote_nodemaps_state {
+	struct ctdb_node_map_old **remote_nodemaps;
+	struct ctdb_recoverd *rec;
+};
+
+static void async_getnodemap_callback(struct ctdb_context *ctdb,
+				      uint32_t node_pnn,
+				      int32_t res,
+				      TDB_DATA outdata,
+				      void *callback_data)
 {
-	struct ctdb_node_map_old **remote_nodemaps = callback_data;
+	struct remote_nodemaps_state *state =
+		(struct remote_nodemaps_state *)callback_data;
+	struct ctdb_node_map_old **remote_nodemaps = state->remote_nodemaps;
+	struct ctdb_node_map_old *nodemap = state->rec->nodemap;
+	size_t i;
 
-	if (node_pnn >= ctdb->num_nodes) {
-		DEBUG(DEBUG_ERR,(__location__ " pnn from invalid node\n"));
+	for (i = 0; i < nodemap->num; i++) {
+		if (nodemap->nodes[i].pnn == node_pnn) {
+			break;
+		}
+	}
+
+	if (i >= nodemap->num) {
+		DBG_ERR("Invalid PNN %"PRIu32"\n", node_pnn);
 		return;
 	}
 
-	remote_nodemaps[node_pnn] = (struct ctdb_node_map_old *)talloc_steal(remote_nodemaps, outdata.dptr);
+	remote_nodemaps[i] = (struct ctdb_node_map_old *)talloc_steal(
+					remote_nodemaps, outdata.dptr);
+
+}
+
+static void async_getnodemap_error(struct ctdb_context *ctdb,
+				   uint32_t node_pnn,
+				   int32_t res,
+				   TDB_DATA outdata,
+				   void *callback_data)
+{
+	struct remote_nodemaps_state *state =
+		(struct remote_nodemaps_state *)callback_data;
+	struct ctdb_recoverd *rec = state->rec;
 
+	DBG_ERR("Failed to retrieve nodemap from node %u\n", node_pnn);
+	ctdb_set_culprit(rec, node_pnn);
 }
 
-static int get_remote_nodemaps(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
-	struct ctdb_node_map_old *nodemap,
-	struct ctdb_node_map_old **remote_nodemaps)
+static int get_remote_nodemaps(struct ctdb_recoverd *rec,
+			       TALLOC_CTX *mem_ctx,
+			       struct ctdb_node_map_old ***remote_nodemaps)
 {
+	struct ctdb_context *ctdb = rec->ctdb;
+	struct ctdb_node_map_old **t;
 	uint32_t *nodes;
+	struct remote_nodemaps_state state;
+	int ret;
 
-	nodes = list_of_active_nodes(ctdb, nodemap, mem_ctx, true);
-	if (ctdb_client_async_control(ctdb, CTDB_CONTROL_GET_NODEMAP,
-					nodes, 0,
-					CONTROL_TIMEOUT(), false, tdb_null,
+	t = talloc_zero_array(mem_ctx,
+			      struct ctdb_node_map_old *,
+			      rec->nodemap->num);
+	if (t == NULL) {
+		DBG_ERR("Memory allocation error\n");
+		return -1;
+	}
+
+	nodes = list_of_connected_nodes(ctdb, rec->nodemap, mem_ctx, false);
+
+	state.remote_nodemaps = t;
+	state.rec = rec;
+
+	ret = ctdb_client_async_control(ctdb,
+					CTDB_CONTROL_GET_NODEMAP,
+					nodes,
+					0,
+					CONTROL_TIMEOUT(),
+					false,
+					tdb_null,
 					async_getnodemap_callback,
-					NULL,
-					remote_nodemaps) != 0) {
-		DEBUG(DEBUG_ERR, (__location__ " Unable to pull all remote nodemaps\n"));
+					async_getnodemap_error,
+					&state);
+	talloc_free(nodes);
 
-		return -1;
+	if (ret != 0) {
+		talloc_free(t);
+		return ret;
 	}
 
+	*remote_nodemaps = t;
 	return 0;
 }
 
@@ -2447,10 +2547,17 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 	}
 
 
-	/* ensure our local copies of flags are right */
-	ret = update_local_flags(rec, nodemap);
+	/* Get the nodemaps for all connected remote nodes */
+	ret = get_remote_nodemaps(rec, mem_ctx, &remote_nodemaps);
 	if (ret != 0) {
-		DEBUG(DEBUG_ERR,("Unable to update local flags\n"));
+		DBG_ERR("Failed to read remote nodemaps\n");
+		return;
+	}
+
+	/* Ensure our local and remote flags are correct */
+	ret = update_flags(rec, nodemap, remote_nodemaps);
+	if (ret != 0) {
+		D_ERR("Unable to update flags\n");
 		return;
 	}
 
@@ -2523,33 +2630,14 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 		goto takeover_run_checks;
 	}
 
-	/* get the nodemap for all active remote nodes
-	 */
-	remote_nodemaps = talloc_array(mem_ctx, struct ctdb_node_map_old *, nodemap->num);
-	if (remote_nodemaps == NULL) {
-		DEBUG(DEBUG_ERR, (__location__ " failed to allocate remote nodemap array\n"));
-		return;
-	}
-	for(i=0; i<nodemap->num; i++) {
-		remote_nodemaps[i] = NULL;
-	}
-	if (get_remote_nodemaps(ctdb, mem_ctx, nodemap, remote_nodemaps) != 0) {
-		DEBUG(DEBUG_ERR,(__location__ " Failed to read remote nodemaps\n"));
-		return;
-	} 
-
 	/* verify that all other nodes have the same nodemap as we have
 	*/
 	for (j=0; j<nodemap->num; j++) {
-		if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
+		if (nodemap->nodes[j].pnn == ctdb->pnn) {
 			continue;
 		}
-
-		if (remote_nodemaps[j] == NULL) {
-			DEBUG(DEBUG_ERR,(__location__ " Did not get a remote nodemap for node %d, restarting monitoring\n", j));
-			ctdb_set_culprit(rec, j);
-
-			return;
+		if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
+			continue;
 		}
 
  		/* if the nodes disagree on how many nodes there are
@@ -2584,6 +2672,9 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 	 * up-to-date information for all the nodes.
 	 */
 	for (j=0; j<nodemap->num; j++) {
+		if (nodemap->nodes[j].pnn == ctdb->pnn) {
+			continue;
+		}
 		if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
 			continue;
 		}
@@ -2591,6 +2682,9 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 	}
 
 	for (j=0; j<nodemap->num; j++) {
+		if (nodemap->nodes[j].pnn == ctdb->pnn) {
+			continue;
+		}
 		if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
 			continue;
 		}
@@ -2610,14 +2704,20 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 				  nodemap->nodes[i].flags));
 				if (i == j) {
 					DEBUG(DEBUG_ERR,("Use flags 0x%02x from remote node %d for cluster update of its own flags\n", remote_nodemaps[j]->nodes[i].flags, j));
-					update_flags_on_all_nodes(ctdb, nodemap, nodemap->nodes[i].pnn, remote_nodemaps[j]->nodes[i].flags);
+					update_flags_on_all_nodes(
+					    rec,
+					    nodemap->nodes[i].pnn,
+					    remote_nodemaps[j]->nodes[i].flags);
 					ctdb_set_culprit(rec, nodemap->nodes[j].pnn);
 					do_recovery(rec, mem_ctx, pnn, nodemap, 
 						    vnnmap);
 					return;
 				} else {
 					DEBUG(DEBUG_ERR,("Use flags 0x%02x from local recmaster node for cluster update of node %d flags\n", nodemap->nodes[i].flags, i));
-					update_flags_on_all_nodes(ctdb, nodemap, nodemap->nodes[i].pnn, nodemap->nodes[i].flags);
+					update_flags_on_all_nodes(
+						rec,
+						nodemap->nodes[i].pnn,
+						nodemap->nodes[i].flags);
 					ctdb_set_culprit(rec, nodemap->nodes[j].pnn);
 					do_recovery(rec, mem_ctx, pnn, nodemap, 
 						    vnnmap);
diff --git a/docs-xml/manpages/winexe.1.xml b/docs-xml/manpages/winexe.1.xml
new file mode 100644
index 00000000000..c0e41c26b15
--- /dev/null
+++ b/docs-xml/manpages/winexe.1.xml
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
+<refentry id="winexe.1">
+
+<refmeta>
+	<refentrytitle>winexe</refentrytitle>
+	<manvolnum>1</manvolnum>
+	<refmiscinfo class="source">Samba</refmiscinfo>
+	<refmiscinfo class="manual">User Commands</refmiscinfo>
+	<refmiscinfo class="version">&doc.version;</refmiscinfo>
+</refmeta>
+
+
+<refnamediv>
+	<refname>winexe</refname>
+	<refpurpose>Winexe is a Remote Windows-command executor</refpurpose>


-- 
Samba Shared Repository



More information about the samba-cvs mailing list