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

Karolin Seeger kseeger at samba.org
Mon Oct 29 13:12:02 UTC 2018


The branch, v4-8-test has been updated
       via  ec065a8 ctdb-event: Check the return status of sock_daemon_set_startup_fd
       via  7ead723 ctdb-common: Set close-on-exec for startup fd
       via  1e07fa9 ctdb-daemon: Exit if eventd goes away
       via  995a75e ctdb-daemon: Return early when refusing to run an event script
      from  59901b7 winbindd_cache: Fix timeout calculation for sid<->name cache

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


- Log -----------------------------------------------------------------
commit ec065a8ac2e4f675ed7cc949ae20e75235dede95
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Oct 10 18:19:32 2018 +1100

    ctdb-event: Check the return status of sock_daemon_set_startup_fd
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13659
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit a1909603808b994b7822b697494e39e8da4aaa66)
    
    Autobuild-User(v4-8-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-8-test): Mon Oct 29 14:11:44 CET 2018 on sn-devel-144

commit 7ead723db077686a33d52af0991825807c058341
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Oct 10 18:16:33 2018 +1100

    ctdb-common: Set close-on-exec for startup fd
    
    The startup_fd should not be propagated to the child processes created
    from a daemon.  It should only be used in the daemon code to return the
    status of the startup.  Another use of startup_fd is to notify the
    parent if the daemon process has exited.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13659
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    (cherry picked from commit 80549927bc1741a4b8af8b8e830de4d37fa0c4a8)

commit 1e07fa98de696165a2391b0c5b58a990e61abcda
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Oct 11 11:26:06 2018 +1100

    ctdb-daemon: Exit if eventd goes away
    
    ctdbd enters a broken state if eventd goes away.  A clean shutdown is
    not possible because that involves running events.  Restarting eventd
    is possible but this might mask a serious problem and it is possible
    that eventd might keep on disappearing.  Just exit.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13659
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit c9e1603a5d0c1a216439d4a2b0e7cdc05181e898)

commit 995a75e4b65d6fbbec808bb395e5c180e55af8ca
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Oct 10 13:35:00 2018 +1100

    ctdb-daemon: Return early when refusing to run an event script
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13659
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    (cherry picked from commit a3d12252fa8e0a7e900b819dec30bdb9da458254)

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

Summary of changes:
 ctdb/common/sock_daemon.c |  8 +++++++-
 ctdb/common/sock_daemon.h |  3 ++-
 ctdb/server/ctdb_eventd.c |  6 +++++-
 ctdb/server/eventscript.c | 10 +++-------
 4 files changed, 17 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/common/sock_daemon.c b/ctdb/common/sock_daemon.c
index 03d3ac1..86cc2f2 100644
--- a/ctdb/common/sock_daemon.c
+++ b/ctdb/common/sock_daemon.c
@@ -517,9 +517,15 @@ int sock_daemon_add_unix(struct sock_daemon_context *sockd,
 	return 0;
 }
 
-void sock_daemon_set_startup_fd(struct sock_daemon_context *sockd, int fd)
+bool sock_daemon_set_startup_fd(struct sock_daemon_context *sockd, int fd)
 {
+	if (! set_close_on_exec(fd)) {
+		D_ERR("Failed to set close-on-exec on startup fd\n");
+		return false;
+	}
+
 	sockd->startup_fd = fd;
+	return true;
 }
 
 /*
diff --git a/ctdb/common/sock_daemon.h b/ctdb/common/sock_daemon.h
index a28f8c6..fb0c686 100644
--- a/ctdb/common/sock_daemon.h
+++ b/ctdb/common/sock_daemon.h
@@ -214,8 +214,9 @@ int sock_daemon_add_unix(struct sock_daemon_context *sockd,
  *
  * @param[in] sockd Socket daemon context
  * @param[in] fd File descriptor
+ * @return true on success, false on error
  */
-void sock_daemon_set_startup_fd(struct sock_daemon_context *sockd, int fd);
+bool sock_daemon_set_startup_fd(struct sock_daemon_context *sockd, int fd);
 
 /**
  * @brief Async computation start to run a socket daemon
diff --git a/ctdb/server/ctdb_eventd.c b/ctdb/server/ctdb_eventd.c
index f79ee99..3876acd 100644
--- a/ctdb/server/ctdb_eventd.c
+++ b/ctdb/server/ctdb_eventd.c
@@ -990,6 +990,7 @@ int main(int argc, const char **argv)
 	struct sock_socket_funcs socket_funcs;
 	struct stat statbuf;
 	int opt, ret;
+	bool ok;
 
 	/* Set default options */
 	options.pid = -1;
@@ -1073,7 +1074,10 @@ int main(int argc, const char **argv)
 	}
 
 	if (options.startup_fd != -1) {
-		sock_daemon_set_startup_fd(sockd, options.startup_fd);
+		ok = sock_daemon_set_startup_fd(sockd, options.startup_fd);
+		if (!ok) {
+			goto fail;
+		}
 	}
 
 	ret = sock_daemon_run(ev, sockd,
diff --git a/ctdb/server/eventscript.c b/ctdb/server/eventscript.c
index 157f653..4a68004 100644
--- a/ctdb/server/eventscript.c
+++ b/ctdb/server/eventscript.c
@@ -370,13 +370,8 @@ static void eventd_dead_handler(struct tevent_context *ev,
 				struct tevent_fd *fde, uint16_t flags,
 				void *private_data)
 {
-	struct eventd_context *ectx = talloc_get_type_abort(
-		private_data, struct eventd_context);
-
-	DEBUG(DEBUG_ERR, ("Eventd went away\n"));
-
-	TALLOC_FREE(ectx->eventd_fde);
-	ectx->eventd_pid = -1;
+	D_ERR("Eventd went away - exiting\n");
+	exit(1);
 }
 
 void ctdb_stop_eventd(struct ctdb_context *ctdb)
@@ -661,6 +656,7 @@ int ctdb_event_script_run(struct ctdb_context *ctdb,
 		DEBUG(DEBUG_ERR,
 		      ("Refusing to run event '%s' while in recovery\n",
 		       ctdb_eventscript_call_names[event]));
+		return -1;
 	}
 
 	state = talloc_zero(mem_ctx, struct ctdb_event_script_run_state);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list