From: Martin Schwenke Date: Tue, 19 May 2020 07:57:35 +0000 (+1000) Subject: ctdb-daemon: Close server socket when switching to client X-Git-Tag: tevent-0.11.0~206 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e40d452722d04d21e1c8cee2af2d175540634070;p=thirdparty%2Fsamba.git ctdb-daemon: Close server socket when switching to client The socket is set close-on-exec but that doesn't help for processes that do not exec(). This should be done for all child processes. This has been seen in testing where "ctdb shutdown" waits for the socket to close before succeeding. It appears that lingering vacuuming processes have not closed the socket when becoming clients so they cause "ctdb shutdown" to hang even though the main daemon process has exited. The cause of the lingering vacuuming processes has been previously examined but still isn't understood. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 9035f5b4748..57f80235e7c 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -2179,6 +2179,11 @@ int switch_from_server_to_client(struct ctdb_context *ctdb) { int ret; + if (ctdb->daemon.sd != -1) { + close(ctdb->daemon.sd); + ctdb->daemon.sd = -1; + } + /* get a new event context */ ctdb->ev = tevent_context_init(ctdb); if (ctdb->ev == NULL) {