The branch, master has been updated
       via  2266e24 smbd: Set process name for notifyd process
       via  0b455a5 smbd: Set process name for async echo handler
       via  96c48b3 s3: Move call to prctl_set_comment to reinit_after_fork
       via  6788a5f lib: Fix prctl detection for prctl_set_comment
      from  969d043 s4: torture: Test mkdir race condition.

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


- Log -----------------------------------------------------------------
commit 2266e2400886d409aa5fa2fe76d83ea8a31e8019
Author: Christof Schmitt <c...@samba.org>
Date:   Wed Sep 23 11:21:21 2015 -0700

    smbd: Set process name for notifyd process
    
    Signed-off-by: Christof Schmitt <c...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    
    Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org>
    Autobuild-Date(master): Thu Sep 24 11:02:44 CEST 2015 on sn-devel-104

commit 0b455a5c2da6b6076450eb5ab5f91b3ab6ca7379
Author: Christof Schmitt <c...@samba.org>
Date:   Wed Sep 23 11:15:44 2015 -0700

    smbd: Set process name for async echo handler
    
    Signed-off-by: Christof Schmitt <c...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 96c48b3c06034a64ee4fb90650dfd5a1059fe83a
Author: Christof Schmitt <c...@samba.org>
Date:   Wed Sep 23 11:14:05 2015 -0700

    s3: Move call to prctl_set_comment to reinit_after_fork
    
    This save a few lines of code.
    
    Signed-off-by: Christof Schmitt <c...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

commit 6788a5f4491cccf5fbe0749d0d1542531e641fc3
Author: Christof Schmitt <c...@samba.org>
Date:   Wed Sep 23 12:28:30 2015 -0700

    lib: Fix prctl detection for prctl_set_comment
    
    Include config.h to make HAVE_PRCTL available for the precompile check.
    
    Signed-off-by: Christof Schmitt <c...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>

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

Summary of changes:
 lib/util/util_process.c          |  1 +
 source3/include/proto.h          |  6 ++++--
 source3/lib/background.c         |  2 +-
 source3/lib/util.c               |  9 ++++++++-
 source3/nmbd/asyncdns.c          |  2 +-
 source3/nmbd/nmbd.c              |  3 +--
 source3/printing/print_cups.c    |  2 +-
 source3/printing/queue_process.c |  4 +---
 source3/printing/spoolssd.c      | 12 +++---------
 source3/rpc_server/epmd.c        |  6 +-----
 source3/rpc_server/fssd.c        |  2 +-
 source3/rpc_server/lsasd.c       | 10 ++--------
 source3/rpc_server/mdssd.c       | 11 ++---------
 source3/smbd/process.c           |  3 ++-
 source3/smbd/scavenger.c         |  5 ++---
 source3/smbd/server.c            | 10 ++++------
 source3/smbd/server_exit.c       |  4 ++--
 source3/winbindd/winbindd.c      |  2 +-
 source3/winbindd/winbindd_dual.c |  2 +-
 19 files changed, 39 insertions(+), 57 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/util_process.c b/lib/util/util_process.c
index 6036e27..bde6060 100644
--- a/lib/util/util_process.c
+++ b/lib/util/util_process.c
@@ -20,6 +20,7 @@
  */
 
 #include "util_process.h"
+#include "config.h"
 
 #ifdef HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 0af8cdd..5b63897 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -376,10 +376,12 @@ int set_blocking(int fd, bool set);
 NTSTATUS init_before_fork(void);
 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
                           struct tevent_context *ev_ctx,
-                          bool parent_longlived);
+                          bool parent_longlived,
+                          const char *comment);
 NTSTATUS smbd_reinit_after_fork(struct messaging_context *msg_ctx,
                                struct tevent_context *ev_ctx,
-                               bool parent_longlived);
+                               bool parent_longlived,
+                               const char *comment);
 void *malloc_(size_t size);
 void *Realloc(void *p, size_t size, bool free_old_on_error);
 void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
diff --git a/source3/lib/background.c b/source3/lib/background.c
index 4ea1282..3c8eb58 100644
--- a/source3/lib/background.c
+++ b/source3/lib/background.c
@@ -176,7 +176,7 @@ static void background_job_waited(struct tevent_req *subreq)
 
                close(fds[0]);
 
-               status = reinit_after_fork(state->msg, state->ev, true);
+               status = reinit_after_fork(state->msg, state->ev, true, NULL);
                if (NT_STATUS_IS_OK(status)) {
                        res = state->fn(state->private_data);
                } else {
diff --git a/source3/lib/util.c b/source3/lib/util.c
index d38d53a..2ac4dbd 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -32,6 +32,7 @@
 #include "serverid.h"
 #include "lib/sys_rw.h"
 #include "lib/sys_rw_data.h"
+#include "lib/util/util_process.h"
 
 #ifdef HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
@@ -430,7 +431,8 @@ static void reinit_after_fork_pipe_handler(struct 
tevent_context *ev,
 
 NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,
                           struct tevent_context *ev_ctx,
-                          bool parent_longlived)
+                          bool parent_longlived,
+                          const char *comment)
 {
        NTSTATUS status = NT_STATUS_OK;
 
@@ -481,6 +483,11 @@ NTSTATUS reinit_after_fork(struct messaging_context 
*msg_ctx,
                                 nt_errstr(status)));
                }
        }
+
+       if (comment) {
+               prctl_set_comment(comment);
+       }
+
  done:
        return status;
 }
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index 5973c8e..66e3674 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -167,7 +167,7 @@ void start_async_dns(struct messaging_context *msg)
        CatchSignal(SIGHUP, SIG_IGN);
         CatchSignal(SIGTERM, sig_term);
 
-       status = reinit_after_fork(msg, nmbd_event_context(), true);
+       status = reinit_after_fork(msg, nmbd_event_context(), true, NULL);
 
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index c7e72de..14eaef6 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -988,8 +988,7 @@ static bool open_sockets(bool isdaemon, int port)
 
        pidfile_create(lp_pid_directory(), "nmbd");
 
-       status = reinit_after_fork(msg, nmbd_event_context(),
-                                  false);
+       status = reinit_after_fork(msg, nmbd_event_context(), false, NULL);
 
        if (!NT_STATUS_IS_OK(status)) {
                exit_daemon("reinit_after_fork() failed", 
map_errno_from_nt_status(status));
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 3ebb2e6..110711c 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -475,7 +475,7 @@ static bool cups_pcap_load_async(struct tevent_context *ev,
 
        close_all_print_db();
 
-       status = reinit_after_fork(msg_ctx, ev, true);
+       status = reinit_after_fork(msg_ctx, ev, true, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
                smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c
index 50622dc..6e31ee4 100644
--- a/source3/printing/queue_process.c
+++ b/source3/printing/queue_process.c
@@ -373,15 +373,13 @@ pid_t start_background_queue(struct tevent_context *ev,
                close(pause_pipe[0]);
                pause_pipe[0] = -1;
 
-               status = smbd_reinit_after_fork(msg_ctx, ev, true);
+               status = smbd_reinit_after_fork(msg_ctx, ev, true, "lpqd");
 
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(0,("reinit_after_fork() failed\n"));
                        smb_panic("reinit_after_fork() failed");
                }
 
-               prctl_set_comment("lpqd");
-
                bq_reopen_logs(logfile);
                bq_setup_sig_term_handler();
                bq_setup_sig_hup_handler(ev, msg_ctx);
diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index 9f533b3..51d10b6 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -20,8 +20,6 @@
 #include "serverid.h"
 #include "smbd/smbd.h"
 
-#include "lib/util/util_process.h"
-
 #include "messages.h"
 #include "include/printing.h"
 #include "printing/nt_printing_migrate_internal.h"
@@ -268,15 +266,12 @@ static bool spoolss_child_init(struct tevent_context 
*ev_ctx,
        struct messaging_context *msg_ctx = server_messaging_context();
        bool ok;
 
-       status = reinit_after_fork(msg_ctx, ev_ctx,
-                                  true);
+       status = reinit_after_fork(msg_ctx, ev_ctx, true, "spoolssd-child");
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                smb_panic("reinit_after_fork() failed");
        }
 
-       prctl_set_comment("spoolssd-child");
-
        spoolss_child_id = child_id;
        spoolss_reopen_logs(child_id);
 
@@ -645,14 +640,13 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
                return pid;
        }
 
-       status = smbd_reinit_after_fork(msg_ctx, ev_ctx, true);
+       status = smbd_reinit_after_fork(msg_ctx, ev_ctx, true,
+                                       "spoolssd-master");
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                smb_panic("reinit_after_fork() failed");
        }
 
-       prctl_set_comment("spoolssd-master");
-
        /* save the parent process id so the children can use it later */
        parent_id = messaging_server_id(msg_ctx);
 
diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c
index f87edd8..faf60f5 100644
--- a/source3/rpc_server/epmd.c
+++ b/source3/rpc_server/epmd.c
@@ -25,8 +25,6 @@
 #include "ntdomain.h"
 #include "messages.h"
 
-#include "lib/util/util_process.h"
-
 #include "librpc/rpc/dcerpc_ep.h"
 #include "../librpc/gen_ndr/srv_epmapper.h"
 #include "rpc_server/rpc_server.h"
@@ -162,14 +160,12 @@ void start_epmd(struct tevent_context *ev_ctx,
                return;
        }
 
-       status = smbd_reinit_after_fork(msg_ctx, ev_ctx, true);
+       status = smbd_reinit_after_fork(msg_ctx, ev_ctx, true, "epmd");
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                smb_panic("reinit_after_fork() failed");
        }
 
-       prctl_set_comment("epmd");
-
        epmd_reopen_logs();
 
        epmd_setup_sig_term_handler(ev_ctx);
diff --git a/source3/rpc_server/fssd.c b/source3/rpc_server/fssd.c
index 81c65a6..1e96afe 100644
--- a/source3/rpc_server/fssd.c
+++ b/source3/rpc_server/fssd.c
@@ -171,7 +171,7 @@ void start_fssd(struct tevent_context *ev_ctx,
        }
 
        /* child */
-       status = smbd_reinit_after_fork(msg_ctx, ev_ctx, true);
+       status = smbd_reinit_after_fork(msg_ctx, ev_ctx, true, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                smb_panic("reinit_after_fork() failed");
diff --git a/source3/rpc_server/lsasd.c b/source3/rpc_server/lsasd.c
index 6fd0817..8cd89a9 100644
--- a/source3/rpc_server/lsasd.c
+++ b/source3/rpc_server/lsasd.c
@@ -24,8 +24,6 @@
 #include "messages.h"
 #include "ntdomain.h"
 
-#include "lib/util/util_process.h"
-
 #include "lib/id_cache.h"
 
 #include "../lib/tsocket/tsocket.h"
@@ -249,14 +247,12 @@ static bool lsasd_child_init(struct tevent_context 
*ev_ctx,
        bool ok;
 
        status = reinit_after_fork(msg_ctx, ev_ctx,
-                                  true);
+                                  true, "lsasd-child");
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                smb_panic("reinit_after_fork() failed");
        }
 
-       prctl_set_comment("lsasd-child");
-
        lsasd_child_id = child_id;
        lsasd_reopen_logs(child_id);
 
@@ -861,14 +857,12 @@ void start_lsasd(struct tevent_context *ev_ctx,
                return;
        }
 
-       status = smbd_reinit_after_fork(msg_ctx, ev_ctx, true);
+       status = smbd_reinit_after_fork(msg_ctx, ev_ctx, true, "lsasd-master");
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                smb_panic("reinit_after_fork() failed");
        }
 
-       prctl_set_comment("lsasd-master");
-
        /* save the parent process id so the children can use it later */
        parent_id = messaging_server_id(msg_ctx);
 
diff --git a/source3/rpc_server/mdssd.c b/source3/rpc_server/mdssd.c
index fac386b..f76d13e 100644
--- a/source3/rpc_server/mdssd.c
+++ b/source3/rpc_server/mdssd.c
@@ -24,8 +24,6 @@
 #include "messages.h"
 #include "ntdomain.h"
 
-#include "lib/util/util_process.h"
-
 #include "lib/id_cache.h"
 
 #include "../lib/tsocket/tsocket.h"
@@ -206,14 +204,12 @@ static bool mdssd_child_init(struct tevent_context 
*ev_ctx,
        bool ok;
 
        status = reinit_after_fork(msg_ctx, ev_ctx,
-                                  true);
+                                  true, "mdssd-child");
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                smb_panic("reinit_after_fork() failed");
        }
 
-       prctl_set_comment("mdssd-child");
-
        mdssd_child_id = child_id;
        reopen_logs();
 
@@ -671,15 +667,12 @@ void start_mdssd(struct tevent_context *ev_ctx,
                return;
        }
 
-       status = reinit_after_fork(msg_ctx,
-                                  ev_ctx,
-                                  true);
+       status = reinit_after_fork(msg_ctx, ev_ctx, true, "mdssd-master");
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                smb_panic("reinit_after_fork() failed");
        }
 
-       prctl_set_comment("mdssd-master");
        reopen_logs();
 
        /* save the parent process id so the children can use it later */
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 6c8a31c..74d34ef 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -3319,7 +3319,8 @@ bool fork_echo_handler(struct smbXsrv_connection *xconn)
                close(listener_pipe[0]);
                set_blocking(listener_pipe[1], false);
 
-               status = smbd_reinit_after_fork(xconn->msg_ctx, xconn->ev_ctx, 
true);
+               status = smbd_reinit_after_fork(xconn->msg_ctx, xconn->ev_ctx,
+                                               true, "smbd-echo");
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(1, ("reinit_after_fork failed: %s\n",
                                  nt_errstr(status)));
diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c
index 6989466..baf71d8 100644
--- a/source3/smbd/scavenger.c
+++ b/source3/smbd/scavenger.c
@@ -254,7 +254,8 @@ static bool smbd_scavenger_start(struct 
smbd_scavenger_state *state)
 
                set_my_unique_id(unique_id);
 
-               status = smbd_reinit_after_fork(state->msg, state->ev, true);
+               status = smbd_reinit_after_fork(state->msg, state->ev,
+                                               true, "smbd-scavenger");
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(2, ("reinit_after_fork failed: %s\n",
                                  nt_errstr(status)));
@@ -262,8 +263,6 @@ static bool smbd_scavenger_start(struct 
smbd_scavenger_state *state)
                        return false;
                }
 
-               prctl_set_comment("smbd-scavenger");
-
                state->am_scavenger = true;
                *state->scavenger_id = messaging_server_id(state->msg);
 
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 8c77500..7b2b055 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -389,7 +389,7 @@ static bool smbd_notifyd_init(struct messaging_context 
*msg, bool interactive)
                return true;
        }
 
-       status = reinit_after_fork(msg, ev, true);
+       status = reinit_after_fork(msg, ev, true, "smbd-notifyd");
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("%s: reinit_after_fork failed: %s\n",
                          __func__, nt_errstr(status)));
@@ -588,7 +588,7 @@ static void smbd_accept_connection(struct tevent_context 
*ev,
        }
 
        if (s->parent->interactive) {
-               reinit_after_fork(msg_ctx, ev, true);
+               reinit_after_fork(msg_ctx, ev, true, NULL);
                smbd_process(ev, msg_ctx, fd, true);
                exit_server_cleanly("end of interactive mode");
                return;
@@ -622,7 +622,7 @@ static void smbd_accept_connection(struct tevent_context 
*ev,
                 * them, counting worker smbds. */
                CatchChild();
 
-               status = smbd_reinit_after_fork(msg_ctx, ev, true);
+               status = smbd_reinit_after_fork(msg_ctx, ev, true, NULL);
                if (!NT_STATUS_IS_OK(status)) {
                        if (NT_STATUS_EQUAL(status,
                                            NT_STATUS_TOO_MANY_OPENED_FILES)) {
@@ -1383,9 +1383,7 @@ extern void build_options(bool screen);
        if (is_daemon)
                pidfile_create(lp_pid_directory(), "smbd");
 
-       status = reinit_after_fork(msg_ctx,
-                                  ev_ctx,
-                                  false);
+       status = reinit_after_fork(msg_ctx, ev_ctx, false, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                exit_daemon("reinit_after_fork() failed", 
map_errno_from_nt_status(status));
        }
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index 700f595..7f1bbbd 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -275,8 +275,8 @@ void smbd_exit_server_cleanly(const char *const explanation)
  */
 NTSTATUS smbd_reinit_after_fork(struct messaging_context *msg_ctx,
                                struct tevent_context *ev_ctx,
-                               bool parent_longlived)
+                               bool parent_longlived, const char *comment)
 {
        am_parent = NULL;
-       return reinit_after_fork(msg_ctx, ev_ctx, parent_longlived);
+       return reinit_after_fork(msg_ctx, ev_ctx, parent_longlived, comment);
 }
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index c878ce2..e6dd0e7 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1754,7 +1754,7 @@ int main(int argc, const char **argv)
 
        status = reinit_after_fork(winbind_messaging_context(),
                                   winbind_event_context(),
-                                  false);
+                                  false, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                exit_daemon("Winbindd reinit_after_fork() failed", 
map_errno_from_nt_status(status));
        }
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 350ec7d..213462e 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -1254,7 +1254,7 @@ NTSTATUS winbindd_reinit_after_fork(const struct 
winbindd_child *myself,
        status = reinit_after_fork(
                winbind_messaging_context(),
                winbind_event_context(),
-               true);
+               true, NULL);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("reinit_after_fork() failed\n"));
                return status;


-- 
Samba Shared Repository

Reply via email to