[SCM] Samba Shared Repository - branch master updated

Martin Schwenke martins at samba.org
Wed Jun 8 02:53:05 UTC 2016


The branch, master has been updated
       via  b7073d4 ctdb-cluster-mutex: Fix #endif decoration
       via  174449c ctdb-recoverd: Release recovery lock on exit
       via  75717ac ctdb-recoverd: Add handler for lost recovery lock
       via  95a7920 ctdb-cluster-mutex: Register an extra handler for when mutex is lost
       via  4f0ca01 ctdb-cluster-mutex: ctdb_cluster_mutex() registers handler and private data
       via  145ddcb ctdb-cluster-mutex: Drop cluster_mutex_handler() ctdb and handle arguments
       via  8cf74f3 ctdb-recovery: Wrap private data for reclock test callback
       via  a192364 ctdb-recoverd: Simplify reclock handler
       via  197264d ctdb-recoverd: Recovery lock handle should be in recovery deamon context
       via  5c4744e ctdb-cluster-mutex: Pass a talloc context to allocate the handle off
       via  58be187 ctdb-recoverd: No need to reset reclock handler
       via  a47da82 ctdb-cluster-mutex: Don't call the supplied hander more than once
       via  630f169 ctdb-recoverd: Fix buggy function return on memory allocation failure
       via  dbd4e67 ctdb-recoverd: Don't expose internal cluster mutex status
       via  fdd214c ctdb-daemon: Rename recovery lock file to just recovery lock
       via  f16b26b ctdb-daemon: Drop function ctdb_set_recovery_lock_file()
       via  5b4dd8c ctdb-protocol: CTDB_CONTROL_SET_RECLOCK_FILE is obsolete
       via  872eb37 ctdb-protocol: Drop support for SET_RECLOCK
       via  312521f ctdb-client: Remove support for SET_RECLOCK
       via  1127f3a ctdb-recovery: Don't update recovery lock from daemon
       via  23823f1 ctdb-recovery: Don't sync recovery lock across cluster
       via  091d4d2 ctdb-recovery: Consistency check reclock in start recovery control
       via  d3da6f0 ctdb-tool: Drop support for "ctdb setreclock" command
       via  a3c2a39 ctdb-tests: Replace "ctdb setrelock" test with "ctdb getreclock" test
      from  08a7866 libsmb: Fix two CIDs for NULL dereference

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


- Log -----------------------------------------------------------------
commit b7073d402121bf362639fce663ff0939678def4c
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Jun 6 15:04:08 2016 +1000

    ctdb-cluster-mutex: Fix #endif decoration
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Wed Jun  8 04:52:18 CEST 2016 on sn-devel-144

commit 174449c1e046b1f579398437f1d47c12dcb7c45a
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jun 2 09:26:40 2016 +1000

    ctdb-recoverd: Release recovery lock on exit
    
    The recovery lock helper must exit when it notices its parent is gone.
    However, that can take a few seconds.
    
    The usual way of terminating the recovery daemon is for the main ctdbd
    to send it a SIGTERM.  Installing a handler is nice and simple.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 75717ac6674981270ff451616a4b35f0e0c5d868
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun May 29 07:25:05 2016 +1000

    ctdb-recoverd: Add handler for lost recovery lock
    
    If the process holding the recovery lock terminates unexpectedly then
    the recovery daemon needs to know that the lock is no longer held.
    
    While here, rename hold_reclock_handler() to take_reclock_handler() so
    there is a clear difference between the two handler names.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 95a7920d2281e05889ff66595c7470f9d6a42295
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jun 1 19:05:47 2016 +1000

    ctdb-cluster-mutex: Register an extra handler for when mutex is lost
    
    Pass NULL if not needed.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 4f0ca0107c83ca0da3e676975543adcbb122b0b9
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jun 1 18:56:33 2016 +1000

    ctdb-cluster-mutex: ctdb_cluster_mutex() registers handler and private data
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 145ddcbe37e274aaa1ddbe77acef3129c486c1b0
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jun 1 17:10:26 2016 +1000

    ctdb-cluster-mutex: Drop cluster_mutex_handler() ctdb and handle arguments
    
    This makes the API more general.  If they are needed in a handler then
    they can be in the private data.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 8cf74f335e442733cbcc02cf33eaa2226b70a8a5
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jun 1 17:45:36 2016 +1000

    ctdb-recovery: Wrap private data for reclock test callback
    
    This will allow a simplification of the cluster mutex API, so the
    private data can be registered when calling ctdb_cluster_mutex().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a192364a1254172329b0b5d687105eed2c537f21
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jun 1 17:32:42 2016 +1000

    ctdb-recoverd: Simplify reclock handler
    
    Do the interesting work outside the handler.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 197264dfe77de454477b9fc458c0a45f564f5cae
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 24 14:54:39 2016 +1000

    ctdb-recoverd: Recovery lock handle should be in recovery deamon context
    
    This shouldn't be in the CTDB context.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5c4744e69d81fd5d2a06de6bf42c5beaf7aac57b
Author: Martin Schwenke <martin at meltin.net>
Date:   Sun May 29 19:27:23 2016 +1000

    ctdb-cluster-mutex: Pass a talloc context to allocate the handle off
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 58be187de02d3c24d2666b91990f9cd2a14f0b7f
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon May 30 12:18:50 2016 +1000

    ctdb-recoverd: No need to reset reclock handler
    
    It won't be called more than once by the cluster mutex code.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a47da8246e3e3523c0152e67277fd6bc825e6b2b
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jun 1 18:46:41 2016 +1000

    ctdb-cluster-mutex: Don't call the supplied hander more than once
    
    After the first activity on the file descriptor, ignore any subsequent
    activity.  Single-shot handlers are easier to write.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 630f169653b731025aeb0babcd8cf0710bc5d316
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jun 1 15:56:42 2016 +1000

    ctdb-recoverd: Fix buggy function return on memory allocation failure
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit dbd4e67aee5c0cd880c3692f66c9f2772f0fb672
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 31 18:37:30 2016 +1000

    ctdb-recoverd: Don't expose internal cluster mutex status
    
    Just expose whether the lock was taken.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit fdd214ce6a0c25007974b54a9edebfbf73e5cf89
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 17 18:28:56 2016 +1000

    ctdb-daemon: Rename recovery lock file to just recovery lock
    
    It isn't necessarily a file.
    
    Don't bother changing the control, since it doesn't pervade the code.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit f16b26bc9712a6d45818ad7af9243feb25fc40a2
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 17 18:24:53 2016 +1000

    ctdb-daemon: Drop function ctdb_set_recovery_lock_file()
    
    Setting the recovery lock file at startup can be done more simply.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 5b4dd8c001c53befd088cdfbdbfaa826315b7a66
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 5 16:13:43 2016 +1000

    ctdb-protocol: CTDB_CONTROL_SET_RECLOCK_FILE is obsolete
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 872eb37eb401c67d3a5875ec4e323498466fd056
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 5 16:12:00 2016 +1000

    ctdb-protocol: Drop support for SET_RECLOCK
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 312521f2647f2798c9a261bfa7e36eb3a54ea321
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 5 16:05:47 2016 +1000

    ctdb-client: Remove support for SET_RECLOCK
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 1127f3ae1e9ef2310cd82db6611e271b1abd7029
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 5 15:34:13 2016 +1000

    ctdb-recovery: Don't update recovery lock from daemon
    
    It can't change after startup.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 23823f128f601216258190803c3129bae49e8889
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 5 15:31:55 2016 +1000

    ctdb-recovery: Don't sync recovery lock across cluster
    
    Support for updating the recovery lock is being removed because it
    isn't possible to recover from failure.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 091d4d2dbbb87a620522e0b0f0ce9393cb21c466
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Apr 5 15:26:22 2016 +1000

    ctdb-recovery: Consistency check reclock in start recovery control
    
    If the recovery lock setting is not consistent with that of the
    recovery master then abort.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit d3da6f0eb91bb38fce4fba9151de93aefda2f32c
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Mar 1 12:32:48 2016 +1100

    ctdb-tool: Drop support for "ctdb setreclock" command
    
    The recovery lock can not be reliably updated at run-time.  If it
    fails to update on some nodes then split-brain protection is gone and
    there is no reasonable way to repair the situation.  CTDB will have to
    be restarted on all nodes.  So, if this feature is being used to avoid
    scheduling an outage then an outage will have to be scheduled just in
    case!
    
    To update the recovery lock, shut down CTDB on all nodes, reconfigure
    the recovery lock and start CTDB again.
    
    Those that *really* want to be able to change the recovery lock at
    run-time can still do so.  Set CTDB_RECOVERY_LOCK to point to a script
    and this script can then be modified at run-time.  However, please
    don't report bugs if bad things happen...
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a3c2a39ea2fb6aed3791e36efe0c0998d7ea83af
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue May 10 19:54:09 2016 +1000

    ctdb-tests: Replace "ctdb setrelock" test with "ctdb getreclock" test
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

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

Summary of changes:
 ctdb/client/client.h                    |   5 -
 ctdb/client/client_control_sync.c       |  29 -----
 ctdb/client/ctdb_client.c               |  28 -----
 ctdb/doc/ctdb.1.xml                     |  37 ------
 ctdb/include/ctdb_client.h              |   3 -
 ctdb/include/ctdb_private.h             |   5 +-
 ctdb/protocol/protocol.h                |   3 +-
 ctdb/protocol/protocol_api.h            |   4 -
 ctdb/protocol/protocol_client.c         |  22 ----
 ctdb/protocol/protocol_control.c        |  16 ---
 ctdb/protocol/protocol_debug.c          |   1 -
 ctdb/server/ctdb_cluster_mutex.c        |  48 +++++---
 ctdb/server/ctdb_cluster_mutex.h        |  19 +--
 ctdb/server/ctdb_control.c              |  38 +-----
 ctdb/server/ctdb_recover.c              | 172 ++++++++++++++++++++-------
 ctdb/server/ctdb_recoverd.c             | 198 ++++++++++++--------------------
 ctdb/server/ctdb_server.c               |  21 ----
 ctdb/server/ctdbd.c                     |  16 ++-
 ctdb/tests/simple/35_ctdb_getreclock.sh |  34 ++++++
 ctdb/tests/simple/35_set_reclock.sh     | 123 --------------------
 ctdb/tests/src/protocol_client_test.c   |  16 ---
 ctdb/tools/ctdb.c                       |  25 ----
 22 files changed, 296 insertions(+), 567 deletions(-)
 create mode 100755 ctdb/tests/simple/35_ctdb_getreclock.sh
 delete mode 100755 ctdb/tests/simple/35_set_reclock.sh


Changeset truncated at 500 lines:

diff --git a/ctdb/client/client.h b/ctdb/client/client.h
index e8288dc..2aca4b5 100644
--- a/ctdb/client/client.h
+++ b/ctdb/client/client.h
@@ -508,11 +508,6 @@ int ctdb_ctrl_get_reclock_file(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 			       int destnode, struct timeval timeout,
 			       const char **reclock_file);
 
-int ctdb_ctrl_set_reclock_file(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-			       struct ctdb_client_context *client,
-			       int destnode, struct timeval timeout,
-			       const char *reclock_file);
-
 int ctdb_ctrl_stop_node(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 			struct ctdb_client_context *client,
 			int destnode, struct timeval timeout);
diff --git a/ctdb/client/client_control_sync.c b/ctdb/client/client_control_sync.c
index e14b02c..9971c9a 100644
--- a/ctdb/client/client_control_sync.c
+++ b/ctdb/client/client_control_sync.c
@@ -1789,35 +1789,6 @@ int ctdb_ctrl_get_reclock_file(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 	return 0;
 }
 
-int ctdb_ctrl_set_reclock_file(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
-			       struct ctdb_client_context *client,
-			       int destnode, struct timeval timeout,
-			       const char *reclock_file)
-{
-	struct ctdb_req_control request;
-	struct ctdb_reply_control *reply;
-	int ret;
-
-	ctdb_req_control_set_reclock_file(&request, reclock_file);
-	ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
-				  &request, &reply);
-	if (ret != 0) {
-		DEBUG(DEBUG_ERR,
-		      ("Control SET_RECLOCK_FILE failed to node %u, ret=%d\n",
-		       destnode, ret));
-		return ret;
-	}
-
-	ret = ctdb_reply_control_set_reclock_file(reply);
-	if (ret != 0) {
-		DEBUG(DEBUG_ERR,
-		      ("Control SET_RECLOCK_FILE failed, ret=%d\n", ret));
-		return ret;
-	}
-
-	return 0;
-}
-
 int ctdb_ctrl_stop_node(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 			struct ctdb_client_context *client,
 			int destnode, struct timeval timeout)
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index 19f126c..4ed8f0a 100644
--- a/ctdb/client/ctdb_client.c
+++ b/ctdb/client/ctdb_client.c
@@ -4313,34 +4313,6 @@ int ctdb_ctrl_getreclock(struct ctdb_context *ctdb, struct timeval timeout,
 }
 
 /*
-  set the reclock filename for a node
- */
-int ctdb_ctrl_setreclock(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, const char *reclock)
-{
-	int ret;
-	TDB_DATA data;
-	int32_t res;
-
-	if (reclock == NULL) {
-	        data.dsize = 0;
-		data.dptr  = NULL;
-	} else {
-	        data.dsize = strlen(reclock) + 1;
-		data.dptr  = discard_const(reclock);
-	}
-
-	ret = ctdb_control(ctdb, destnode, 0, 
-			   CTDB_CONTROL_SET_RECLOCK_FILE, 0, data, 
-			   NULL, NULL, &res, &timeout, NULL);
-	if (ret != 0 || res != 0) {
-		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for setreclock failed\n"));
-		return -1;
-	}
-
-	return 0;
-}
-
-/*
   stop a node
  */
 int ctdb_ctrl_stop_node(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode)
diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml
index cbdc5c7..bbe102f 100644
--- a/ctdb/doc/ctdb.1.xml
+++ b/ctdb/doc/ctdb.1.xml
@@ -968,43 +968,6 @@ DB Statistics: locking.tdb
     </refsect2>
 
     <refsect2>
-      <title>
-	setreclock <optional><parameter>FILE</parameter></optional>
-      </title>
-
-      <para>
-	FILE specifies the name of the recovery lock file.  If the
-	recovery lock file is changed at run-time then this will cause
-	a recovery, which in turn causes the recovery lock to be
-	retaken.
-      </para>
-
-      <para>
-	If no FILE is specified then a recovery lock file will no
-	longer be used.
-      </para>
-
-      <para>
-	This command only affects the run-time setting of a single
-	CTDB node.  This setting <emphasis>must</emphasis> be changed
-	on all nodes simultaneously.  For information about configuring
-	the recovery lock file please see the
-	<citetitle>CTDB_RECOVERY_LOCK</citetitle> entry in
-	<citerefentry><refentrytitle>ctdbd.conf</refentrytitle>
-	<manvolnum>5</manvolnum></citerefentry> and the
-	<citetitle>--reclock</citetitle> entry in
-	<citerefentry><refentrytitle>ctdbd</refentrytitle>
-	<manvolnum>1</manvolnum></citerefentry>.  For information
-	about the recovery lock please see the <citetitle>RECOVERY
-	LOCK</citetitle> section in
-	<citerefentry><refentrytitle>ctdb</refentrytitle>
-	<manvolnum>7</manvolnum></citerefentry>.
-      </para>
-    </refsect2>
-
-
-
-    <refsect2>
       <title>getdebug</title>
       <para>
 	Get the current debug level for the node. the debug level controls what information is written to the log file.
diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h
index a39d096..606461c 100644
--- a/ctdb/include/ctdb_client.h
+++ b/ctdb/include/ctdb_client.h
@@ -555,9 +555,6 @@ int ctdb_ctrl_report_recd_lock_latency(struct ctdb_context *ctdb,
 int ctdb_ctrl_getreclock(struct ctdb_context *ctdb,
 			 struct timeval timeout, uint32_t destnode,
 			 TALLOC_CTX *mem_ctx, const char **reclock);
-int ctdb_ctrl_setreclock(struct ctdb_context *ctdb,
-			 struct timeval timeout, uint32_t destnode,
-			 const char *reclock);
 
 int ctdb_ctrl_stop_node(struct ctdb_context *ctdb, struct timeval timeout,
 			uint32_t destnode);
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index a2f6dfc..f4f5b67 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -310,8 +310,7 @@ struct ctdb_context {
 	uint64_t db_persistent_check_errors;
 	uint64_t max_persistent_check_errors;
 	const char *transport;
-	char *recovery_lock_file;
-	struct ctdb_cluster_mutex_handle *recovery_lock_handle;
+	const char *recovery_lock;
 	uint32_t pnn; /* our own pnn */
 	uint32_t num_nodes;
 	uint32_t num_connected;
@@ -922,8 +921,6 @@ int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport);
 
 int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const ctdb_sock_addr *nodeip);
 
-int ctdb_set_recovery_lock_file(struct ctdb_context *ctdb, const char *file);
-
 void ctdb_load_nodes_file(struct ctdb_context *ctdb);
 
 int ctdb_set_address(struct ctdb_context *ctdb, const char *address);
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index 7f2ba92..a46d654 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -313,7 +313,7 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
 		    CTDB_CONTROL_TRAVERSE_KILL           = 97,
 		    CTDB_CONTROL_RECD_RECLOCK_LATENCY    = 98,
 		    CTDB_CONTROL_GET_RECLOCK_FILE        = 99,
-		    CTDB_CONTROL_SET_RECLOCK_FILE        = 100,
+		    CTDB_CONTROL_SET_RECLOCK_FILE        = 100, /* obsolete */
 		    CTDB_CONTROL_STOP_NODE               = 101,
 		    CTDB_CONTROL_CONTINUE_NODE           = 102,
 		    CTDB_CONTROL_SET_NATGWSTATE          = 103, /* obsolete */
@@ -867,7 +867,6 @@ struct ctdb_req_control_data {
 		struct ctdb_public_ip *pubip;
 		enum ctdb_event event;
 		double reclock_latency;
-		const char *reclock_file;
 		uint32_t role;
 		const char *script;
 		struct ctdb_ban_state *ban_state;
diff --git a/ctdb/protocol/protocol_api.h b/ctdb/protocol/protocol_api.h
index 17ed8c3..055de44 100644
--- a/ctdb/protocol/protocol_api.h
+++ b/ctdb/protocol/protocol_api.h
@@ -457,10 +457,6 @@ int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
 					TALLOC_CTX *mem_ctx,
 					const char **reclock_file);
 
-void ctdb_req_control_set_reclock_file(struct ctdb_req_control *request,
-				       const char *reclock_file);
-int ctdb_reply_control_set_reclock_file(struct ctdb_reply_control *reply);
-
 void ctdb_req_control_stop_node(struct ctdb_req_control *request);
 int ctdb_reply_control_stop_node(struct ctdb_reply_control *reply);
 
diff --git a/ctdb/protocol/protocol_client.c b/ctdb/protocol/protocol_client.c
index 7355378..e148b77 100644
--- a/ctdb/protocol/protocol_client.c
+++ b/ctdb/protocol/protocol_client.c
@@ -1591,28 +1591,6 @@ int ctdb_reply_control_get_reclock_file(struct ctdb_reply_control *reply,
 	return reply->status;
 }
 
-/* CTDB_CONTROL_SET_RECLOCK_FILE */
-
-void ctdb_req_control_set_reclock_file(struct ctdb_req_control *request,
-				       const char *reclock_file)
-{
-	request->opcode = CTDB_CONTROL_SET_RECLOCK_FILE;
-	request->pad = 0;
-	request->srvid = 0;
-	request->client_id = 0;
-	request->flags = 0;
-
-	request->rdata.opcode = CTDB_CONTROL_SET_RECLOCK_FILE;
-	request->rdata.data.reclock_file = reclock_file;
-}
-
-int ctdb_reply_control_set_reclock_file(struct ctdb_reply_control *reply)
-{
-	return ctdb_reply_control_generic(reply,
-					  CTDB_CONTROL_SET_RECLOCK_FILE);
-}
-
-
 /* CTDB_CONTROL_STOP_NODE */
 
 void ctdb_req_control_stop_node(struct ctdb_req_control *request)
diff --git a/ctdb/protocol/protocol_control.c b/ctdb/protocol/protocol_control.c
index fc2e6da..f1c03ae 100644
--- a/ctdb/protocol/protocol_control.c
+++ b/ctdb/protocol/protocol_control.c
@@ -304,10 +304,6 @@ static size_t ctdb_req_control_data_len(struct ctdb_req_control_data *cd)
 	case CTDB_CONTROL_GET_RECLOCK_FILE:
 		break;
 
-	case CTDB_CONTROL_SET_RECLOCK_FILE:
-		len = ctdb_string_len(cd->data.reclock_file);
-		break;
-
 	case CTDB_CONTROL_STOP_NODE:
 		break;
 
@@ -636,10 +632,6 @@ static void ctdb_req_control_data_push(struct ctdb_req_control_data *cd,
 		ctdb_double_push(cd->data.reclock_latency, buf);
 		break;
 
-	case CTDB_CONTROL_SET_RECLOCK_FILE:
-		ctdb_string_push(cd->data.reclock_file, buf);
-		break;
-
 	case CTDB_CONTROL_SET_LMASTERROLE:
 		ctdb_uint32_push(cd->data.role, buf);
 		break;
@@ -979,11 +971,6 @@ static int ctdb_req_control_data_pull(uint8_t *buf, size_t buflen,
 				       &cd->data.reclock_latency);
 		break;
 
-	case CTDB_CONTROL_SET_RECLOCK_FILE:
-		ret = ctdb_string_pull(buf, buflen, mem_ctx,
-				       &cd->data.reclock_file);
-		break;
-
 	case CTDB_CONTROL_SET_LMASTERROLE:
 		ret = ctdb_uint32_pull(buf, buflen, mem_ctx,
 				     &cd->data.role);
@@ -1393,9 +1380,6 @@ static size_t ctdb_reply_control_data_len(struct ctdb_reply_control_data *cd)
 		len = ctdb_string_len(cd->data.reclock_file);
 		break;
 
-	case CTDB_CONTROL_SET_RECLOCK_FILE:
-		break;
-
 	case CTDB_CONTROL_STOP_NODE:
 		break;
 
diff --git a/ctdb/protocol/protocol_debug.c b/ctdb/protocol/protocol_debug.c
index b86f1c2..76d796e 100644
--- a/ctdb/protocol/protocol_debug.c
+++ b/ctdb/protocol/protocol_debug.c
@@ -190,7 +190,6 @@ static void ctdb_opcode_print(uint32_t opcode, FILE *fp)
 		{ CTDB_CONTROL_TRAVERSE_KILL, "TRAVERSE_KILL" },
 		{ CTDB_CONTROL_RECD_RECLOCK_LATENCY, "RECD_RECLOCK_LATENCY" },
 		{ CTDB_CONTROL_GET_RECLOCK_FILE, "GET_RECLOCK_FILE" },
-		{ CTDB_CONTROL_SET_RECLOCK_FILE, "SET_RECLOCK_FILE" },
 		{ CTDB_CONTROL_STOP_NODE, "STOP_NODE" },
 		{ CTDB_CONTROL_CONTINUE_NODE, "CONTINUE_NODE" },
 		{ CTDB_CONTROL_SET_NATGWSTATE, "SET_NATGWSTATE" },
diff --git a/ctdb/server/ctdb_cluster_mutex.c b/ctdb/server/ctdb_cluster_mutex.c
index 12950c4..fa70a00 100644
--- a/ctdb/server/ctdb_cluster_mutex.c
+++ b/ctdb/server/ctdb_cluster_mutex.c
@@ -40,21 +40,16 @@ struct ctdb_cluster_mutex_handle {
 	struct ctdb_context *ctdb;
 	cluster_mutex_handler_t handler;
 	void *private_data;
+	cluster_mutex_lost_handler_t lost_handler;
+	void *lost_data;
 	int fd[2];
 	struct tevent_timer *te;
 	struct tevent_fd *fde;
 	pid_t child;
 	struct timeval start_time;
+	bool have_response;
 };
 
-void ctdb_cluster_mutex_set_handler(struct ctdb_cluster_mutex_handle *h,
-				    cluster_mutex_handler_t handler,
-				    void *private_data)
-{
-	h->handler = handler;
-	h->private_data = private_data;
-}
-
 static void cluster_mutex_timeout(struct tevent_context *ev,
 				  struct tevent_timer *te,
 				  struct timeval t, void *private_data)
@@ -64,7 +59,7 @@ static void cluster_mutex_timeout(struct tevent_context *ev,
 	double latency = timeval_elapsed(&h->start_time);
 
 	if (h->handler != NULL) {
-		h->handler(h->ctdb, '2', latency, h, h->private_data);
+		h->handler('2', latency, h->private_data);
 	}
 }
 
@@ -98,12 +93,25 @@ static void cluster_mutex_handler(struct tevent_context *ev,
 
 	ret = sys_read(h->fd[0], &c, 1);
 
+	/* Don't call the handler more than once.  It only exists to
+	 * process the initial response from the helper. */
+	if (h->have_response) {
+		/* Only deal with EOF due to process exit.  Silently
+		 * ignore any other output. */
+		if (ret == 0) {
+			if (h->lost_handler != NULL) {
+				h->lost_handler(h->lost_data);
+			}
+		}
+		return;
+	}
+	h->have_response = true;
+
 	/* If the child wrote status then just pass it to the handler.
 	 * If no status was written then this is an unexpected error
 	 * so pass generic error code to handler. */
 	if (h->handler != NULL) {
-		h->handler(h->ctdb, ret == 1 ? c : '3', latency,
-			   h, h->private_data);
+		h->handler(ret == 1 ? c : '3', latency, h->private_data);
 	}
 }
 
@@ -176,15 +184,20 @@ static bool cluster_mutex_helper_args(TALLOC_CTX *mem_ctx,
 }
 
 struct ctdb_cluster_mutex_handle *
-ctdb_cluster_mutex(struct ctdb_context *ctdb,
+ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
+		   struct ctdb_context *ctdb,
 		   const char *argstring,
-		   int timeout)
+		   int timeout,
+		   cluster_mutex_handler_t handler,
+		   void *private_data,
+		   cluster_mutex_lost_handler_t lost_handler,
+		   void *lost_data)
 {
 	struct ctdb_cluster_mutex_handle *h;
 	char **args;
 	int ret;
 
-	h = talloc(ctdb, struct ctdb_cluster_mutex_handle);
+	h = talloc(mem_ctx, struct ctdb_cluster_mutex_handle);
 	if (h == NULL) {
 		DEBUG(DEBUG_ERR, (__location__ " out of memory\n"));
 		return NULL;
@@ -193,6 +206,7 @@ ctdb_cluster_mutex(struct ctdb_context *ctdb,
 	h->start_time = timeval_current();
 	h->fd[0] = -1;
 	h->fd[1] = -1;
+	h->have_response = false;
 
 	ret = pipe(h->fd);
 	if (ret != 0) {
@@ -259,8 +273,10 @@ ctdb_cluster_mutex(struct ctdb_context *ctdb,
 	tevent_fd_set_auto_close(h->fde);
 
 	h->ctdb = ctdb;
-	h->handler = NULL;
-	h->private_data = NULL;
+	h->handler = handler;
+	h->private_data = private_data;
+	h->lost_handler = lost_handler;
+	h->lost_data = lost_data;
 
 	return h;
 }
diff --git a/ctdb/server/ctdb_cluster_mutex.h b/ctdb/server/ctdb_cluster_mutex.h
index 9131eb3..4587290 100644
--- a/ctdb/server/ctdb_cluster_mutex.h
+++ b/ctdb/server/ctdb_cluster_mutex.h
@@ -22,6 +22,8 @@
 #ifndef __CTDB_CLUSTER_MUTEX_H__
 #define __CTDB_CLUSTER_MUTEX_H__
 
+#include <talloc.h>
+
 #include "replace.h"
 #include "system/network.h"
 
@@ -30,19 +32,20 @@
 struct ctdb_cluster_mutex_handle;
 
 typedef void (*cluster_mutex_handler_t) (
-	struct ctdb_context *ctdb,
 	char status,
 	double latency,
-	struct ctdb_cluster_mutex_handle *h,
 	void *private_data);
 
-void ctdb_cluster_mutex_set_handler(struct ctdb_cluster_mutex_handle *h,
-				    cluster_mutex_handler_t handler,
-				    void *private_data);
+typedef void (*cluster_mutex_lost_handler_t) (void *private_data);
 
 struct ctdb_cluster_mutex_handle *
-ctdb_cluster_mutex(struct ctdb_context *ctdb,
+ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
+		   struct ctdb_context *ctdb,
 		   const char *argstring,
-		   int timeout);
+		   int timeout,
+		   cluster_mutex_handler_t handler,
+		   void *private_data,
+		   cluster_mutex_lost_handler_t lost_handler,
+		   void *lost_data);
 
-#endif /* __CTDB_IPALLOC_H__ */
+#endif /* __CTDB_CLUSTER_MUTEX_H__ */
diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c
index 9819176..715ea6c 100644
--- a/ctdb/server/ctdb_control.c
+++ b/ctdb/server/ctdb_control.c
@@ -509,41 +509,13 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 		return 0;
 	case CTDB_CONTROL_GET_RECLOCK_FILE:
 		CHECK_CONTROL_DATA_SIZE(0);
-		if (ctdb->recovery_lock_file != NULL) {
-			outdata->dptr  = discard_const(ctdb->recovery_lock_file);
-			outdata->dsize = strlen(ctdb->recovery_lock_file) + 1;
+		if (ctdb->recovery_lock != NULL) {
+			outdata->dptr  = discard_const(ctdb->recovery_lock);
+			outdata->dsize = strlen(ctdb->recovery_lock) + 1;
 		}
 		return 0;
-	case CTDB_CONTROL_SET_RECLOCK_FILE: {
-		char *t;
-
-		if (indata.dsize == 0) {
-			TALLOC_FREE(ctdb->recovery_lock_file);
-			return 0;
-		}
-
-		/* Return silent success if unchanged.  Recovery
-		 * master updates all nodes on each recovery - we
-		 * don't need the extra memory allocation or log
-		 * message each time. */
-		if (ctdb->recovery_lock_file != NULL &&
-		    strcmp(discard_const(indata.dptr),
-			   ctdb->recovery_lock_file) == 0) {
-			return 0;
-		}
-
-		t = talloc_strdup(ctdb, discard_const(indata.dptr));
-		if (t == NULL) {
-			DEBUG(DEBUG_ERR, ("Out of memory in SET_RECLOCK_FILE\n"));
-			return -1;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list