From 3a0cfad2238ce5701102587c6b50ef088c7c55ba Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 5 Feb 2008 09:16:57 +0100 Subject: prefork: also reload stuff in the client processes metze (This used to be commit 36012c386b30af98f10ada1b77ca3e43dbd7b144) --- source4/smbd/process_prefork.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'source4/smbd') diff --git a/source4/smbd/process_prefork.c b/source4/smbd/process_prefork.c index ab4a89bd26..839c7209d2 100644 --- a/source4/smbd/process_prefork.c +++ b/source4/smbd/process_prefork.c @@ -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 */ -- cgit