prefork: also reload stuff in the client processes
authorStefan Metzmacher <metze@samba.org>
Tue, 5 Feb 2008 08:16:57 +0000 (09:16 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 6 Feb 2008 13:44:20 +0000 (14:44 +0100)
metze
(This used to be commit 36012c386b30af98f10ada1b77ca3e43dbd7b144)

source4/smbd/process_prefork.c

index ab4a89bd26216351fef8d9b76e416a970e474cde..839c7209d2b47502f099af951ffb328a8860e99c 100644 (file)
@@ -54,6 +54,17 @@ static void prefork_model_init(struct event_context *ev)
        signal(SIGCHLD, SIG_IGN);
 }
 
+static void prefork_reload_after_fork(void)
+{
+       /* tdb needs special fork handling */
+       if (tdb_reopen_all(1) == -1) {
+               DEBUG(0,("prefork_reload_after_fork: tdb_reopen_all failed.\n"));
+       }
+
+       /* Ensure that the forked children do not expose identical random streams */
+       set_need_random_reseed();
+}
+
 /*
   called when a listening socket becomes readable. 
 */
@@ -115,16 +126,10 @@ static void prefork_new_task(struct event_context *ev,
           is not associated with this new connection */
        talloc_free(ev);
 
-       /* tdb needs special fork handling */
-       if (tdb_reopen_all(1) == -1) {
-               DEBUG(0,("prefork_accept_connection: tdb_reopen_all failed.\n"));
-       }
-
-       /* Ensure that the forked children do not expose identical random streams */
-       set_need_random_reseed();
-
        setproctitle("task %s server_id[%d]", service_name, pid);
 
+       prefork_reload_after_fork();
+
        /* setup this new connection: process will bind to it's sockets etc */
        new_task_fn(ev2, lp_ctx, cluster_id(pid, 0), private);
 
@@ -151,6 +156,9 @@ static void prefork_new_task(struct event_context *ev,
                } else {
                        pid = getpid();
                        setproctitle("task %s server_id[%d]", service_name, pid);
+
+                       prefork_reload_after_fork();
+
                        /* we can't return to the top level here, as that event context is gone,
                           so we now process events in the new event context until there are no
                           more to process */