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

Stefan Metzmacher metze at samba.org
Thu Aug 27 12:12:02 UTC 2020


The branch, v4-13-test has been updated
       via  58627af19cc ctdb-recoverd: Rename update_local_flags() -> update_flags()
       via  98580fca5f6 ctdb-recoverd: Change update_local_flags() to use already retrieved nodemaps
       via  8e10b67f315 ctdb-recoverd: Get remote nodemaps earlier
       via  7fe08880958 ctdb-recoverd: Do not fetch the nodemap from the recovery master
       via  48ca1987350 ctdb-recoverd: Change get_remote_nodemaps() to use connected nodes
       via  a1f00ebef11 ctdb-recoverd: Fix node_pnn check and assignment of nodemap into array
       via  da94f78c55e ctdb-recoverd: Add fail callback to assign banning credits
       via  05b46fa631b ctdb-recoverd: Add an intermediate state struct for nodemap fetching
       via  092beb2f6f1 ctdb-recoverd: Move memory allocation into get_remote_nodemaps()
       via  97ed7d289c7 ctdb-recoverd: Change signature of get_remote_nodemaps()
       via  245f0043d88 ctdb-recoverd: Fix a local memory leak
       via  772dfb02d45 ctdb-recoverd: Basic cleanups for get_remote_nodemaps()
       via  3261adfc84f ctdb-recoverd: Simplify calculation of new flags
       via  991907cf217 ctdb-recoverd: Correctly find nodemap entry for pnn
       via  b0bf26df6c8 ctdb-recoverd: Do not retrieve nodemap from recovery master
       via  6d8271ff3b7 ctdb-recoverd: Flatten update_flags_on_all_nodes()
       via  267bb7faf22 ctdb-recoverd: Move ctdb_ctrl_modflags() to ctdb_recoverd.c
       via  299d4e3f3b0 ctdb-recoverd: Improve a call to update_flags_on_all_nodes()
       via  abc8222fa5d ctdb-recoverd: Use update_flags_on_all_nodes()
       via  6fc2ec1653a ctdb-recoverd: Introduce some local variables to improve readability
       via  3e3124afa3b ctdb-recoverd: Change update_flags_on_all_nodes() to take rec argument
       via  5ad1f837d65 ctdb-recoverd: Drop unused nodemap argument from update_flags_on_all_nodes()
       via  51f8ccf2887 docs: Add missing winexe manpage
      from  e0aa042c518 WHATSNEW: list deprecated parameters

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


- Log -----------------------------------------------------------------
commit 58627af19cc9d57d4d36d26406884c7e35036929
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-13-test): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(v4-13-test): Thu Aug 27 12:11:01 UTC 2020 on sn-devel-184

commit 98580fca5f681e19d7310006f6e85607a3f7871c
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 8e10b67f315338e0e6640819adcb334e75dd0507
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 7fe088809585285aaed835a622d92ebb2dec7406
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 48ca1987350683b58c9bd43cd54ea9e2614da337
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 a1f00ebef11708808c399f8b0d446b309e5da016
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 da94f78c55e2c06ebb3a581f8e00da496806ef0e
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 05b46fa631bec783371745a82e7f63ebc7783a7b
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 092beb2f6f117640396a38d933814a7cd4d50512
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 97ed7d289c7e61dc73688f9c162be6345028548d
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 245f0043d888fcff392fa8e44322359f0fa5bc82
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 772dfb02d45d61115e6c242e6fd9fd26b3a14efc
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 3261adfc84ffa68ffb5549eebefc36fdc52b2b40
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 991907cf21798b39705c8799eac2b4944e3801c1
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 b0bf26df6c8281b1447979cf830660bd6165ba76
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 6d8271ff3b7863bf9f4bcc7ee8bb6793c241a66a
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 267bb7faf222cd3160f5d9451aa86b29cff9787c
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 299d4e3f3b00c2031fd0bc00d4ac68624e42fbd2
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 abc8222fa5d4d01d35e554066b1da232ea9c5efc
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 6fc2ec1653a4867fe2321b03d752571bd337a605
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 3e3124afa3bbbcece4885e945fa801ad4e489e05
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 5ad1f837d65b656bf73b0415de3b862d42fb840f
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 51f8ccf2887ed5a478170292d49756c60bc990b3
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