[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4782-gada3145

Jeremy Allison jra at samba.org
Tue Jan 6 00:21:18 GMT 2009


The branch, v3-3-test has been updated
       via  ada3145ffe40dfbe89f968e844bfb139a58eab5d (commit)
      from  9f5c7f55abae9278d4e7ca2f359da1b52d0409a2 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit ada3145ffe40dfbe89f968e844bfb139a58eab5d
Author: Bo Yang <boyang at novell.com>
Date:   Mon Jan 5 16:19:48 2009 -0800

    clean event context after child is forked.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 source/include/proto.h          |    2 +
 source/lib/events.c             |    6 +++++
 source/lib/util.c               |    3 ++
 source/nmbd/asyncdns.c          |    3 +-
 source/nmbd/nmbd.c              |    3 +-
 source/printing/print_cups.c    |    3 +-
 source/printing/printing.c      |    3 +-
 source/smbd/server.c            |    7 ++++-
 source/winbindd/winbindd.c      |    3 +-
 source/winbindd/winbindd_cm.c   |    3 +-
 source/winbindd/winbindd_dual.c |   40 +++++++++++++++++++++++---------------
 11 files changed, 52 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/proto.h b/source/include/proto.h
index 95de3f9..98dcf4f 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -552,6 +552,7 @@ bool run_events(struct event_context *event_ctx,
 struct timeval *get_timed_events_timeout(struct event_context *event_ctx,
 					 struct timeval *to_ret);
 int event_loop_once(struct event_context *ev);
+void event_context_reinit(struct event_context *ev);
 struct event_context *event_context_init(TALLOC_CTX *mem_ctx);
 int set_event_dispatch_time(struct event_context *event_ctx,
 			    const char *event_name, struct timeval when);
@@ -1297,6 +1298,7 @@ int set_blocking(int fd, bool set);
 void smb_msleep(unsigned int t);
 void become_daemon(bool Fork, bool no_process_group);
 bool reinit_after_fork(struct messaging_context *msg_ctx,
+		       struct event_context *ev_ctx,
 		       bool parent_longlived);
 bool yesno(const char *p);
 void *malloc_(size_t size);
diff --git a/source/lib/events.c b/source/lib/events.c
index f031387..8e6b0fb 100644
--- a/source/lib/events.c
+++ b/source/lib/events.c
@@ -369,6 +369,12 @@ static int event_context_destructor(struct event_context *ev)
 	return 0;
 }
 
+void event_context_reinit(struct event_context *ev)
+{
+	event_context_destructor(ev);
+	return;
+}
+
 struct event_context *event_context_init(TALLOC_CTX *mem_ctx)
 {
 	struct event_context *result;
diff --git a/source/lib/util.c b/source/lib/util.c
index 4b8b597..262d37f 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -1038,6 +1038,7 @@ void become_daemon(bool Fork, bool no_process_group)
 }
 
 bool reinit_after_fork(struct messaging_context *msg_ctx,
+		       struct event_context *ev_ctx,
 		       bool parent_longlived)
 {
 	NTSTATUS status;
@@ -1065,6 +1066,8 @@ bool reinit_after_fork(struct messaging_context *msg_ctx,
 		return false;
 	}
 
+	event_context_reinit(ev_ctx);
+
 	return true;
 }
 
diff --git a/source/nmbd/asyncdns.c b/source/nmbd/asyncdns.c
index ab9b1ed..baa88bc 100644
--- a/source/nmbd/asyncdns.c
+++ b/source/nmbd/asyncdns.c
@@ -164,7 +164,8 @@ void start_async_dns(void)
 	CatchSignal(SIGHUP, SIG_IGN);
         CatchSignal(SIGTERM, SIGNAL_CAST sig_term );
 
-	if (!reinit_after_fork(nmbd_messaging_context(), true)) {
+	if (!reinit_after_fork(nmbd_messaging_context(),
+			       nmbd_event_context(), true)) {
 		DEBUG(0,("reinit_after_fork() failed\n"));
 		smb_panic("reinit_after_fork() failed");
 	}
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c
index 524423f..7ea2bd0 100644
--- a/source/nmbd/nmbd.c
+++ b/source/nmbd/nmbd.c
@@ -911,7 +911,8 @@ static bool open_sockets(bool isdaemon, int port)
 
 	pidfile_create("nmbd");
 
-	if (!reinit_after_fork(nmbd_messaging_context(), false)) {
+	if (!reinit_after_fork(nmbd_messaging_context(),
+			       nmbd_event_context(), false)) {
 		DEBUG(0,("reinit_after_fork() failed\n"));
 		exit(1);
 	}
diff --git a/source/printing/print_cups.c b/source/printing/print_cups.c
index 9c555a6..9a09f7e 100644
--- a/source/printing/print_cups.c
+++ b/source/printing/print_cups.c
@@ -427,7 +427,8 @@ static bool cups_pcap_load_async(int *pfd)
 	/* Child. */
 	close_all_print_db();
 
-	if (!reinit_after_fork(smbd_messaging_context(), true)) {
+	if (!reinit_after_fork(smbd_messaging_context(),
+			smbd_event_context(), true)) {
 		DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
 		smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
 	}
diff --git a/source/printing/printing.c b/source/printing/printing.c
index 724cdc9..a9272eb 100644
--- a/source/printing/printing.c
+++ b/source/printing/printing.c
@@ -1421,7 +1421,8 @@ void start_background_queue(void)
 		close(pause_pipe[0]);
 		pause_pipe[0] = -1;
 
-		if (!reinit_after_fork(smbd_messaging_context(), true)) {
+		if (!reinit_after_fork(smbd_messaging_context(),
+				       smbd_event_context(), true)) {
 			DEBUG(0,("reinit_after_fork() failed\n"));
 			smb_panic("reinit_after_fork() failed");
 		}
diff --git a/source/smbd/server.c b/source/smbd/server.c
index 4f47517..fb6bbff 100644
--- a/source/smbd/server.c
+++ b/source/smbd/server.c
@@ -753,7 +753,9 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_
 								false);
 
 				if (!reinit_after_fork(
-					    smbd_messaging_context(), true)) {
+					    smbd_messaging_context(),
+					    smbd_event_context(),
+					    true)) {
 					DEBUG(0,("reinit_after_fork() failed\n"));
 					smb_panic("reinit_after_fork() failed");
 				}
@@ -1327,7 +1329,8 @@ extern void build_options(bool screen);
 	if (is_daemon)
 		pidfile_create("smbd");
 
-	if (!reinit_after_fork(smbd_messaging_context(), false)) {
+	if (!reinit_after_fork(smbd_messaging_context(),
+			       smbd_event_context(), false)) {
 		DEBUG(0,("reinit_after_fork() failed\n"));
 		exit(1);
 	}
diff --git a/source/winbindd/winbindd.c b/source/winbindd/winbindd.c
index bf2937c..ea0864f 100644
--- a/source/winbindd/winbindd.c
+++ b/source/winbindd/winbindd.c
@@ -1191,7 +1191,8 @@ int main(int argc, char **argv, char **envp)
 
 	TimeInit();
 
-	if (!reinit_after_fork(winbind_messaging_context(), false)) {
+	if (!reinit_after_fork(winbind_messaging_context(),
+			       winbind_event_context(), false)) {
 		DEBUG(0,("reinit_after_fork() failed\n"));
 		exit(1);
 	}
diff --git a/source/winbindd/winbindd_cm.c b/source/winbindd/winbindd_cm.c
index a918fb8..51ecc1f 100644
--- a/source/winbindd/winbindd_cm.c
+++ b/source/winbindd/winbindd_cm.c
@@ -212,7 +212,8 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
 
 	/* Leave messages blocked - we will never process one. */
 
-	if (!reinit_after_fork(winbind_messaging_context(), true)) {
+	if (!reinit_after_fork(winbind_messaging_context(),
+			       winbind_event_context(), true)) {
 		DEBUG(0,("reinit_after_fork() failed\n"));
 		messaging_send_buf(winbind_messaging_context(),
 				   pid_to_procid(parent_pid),
diff --git a/source/winbindd/winbindd_dual.c b/source/winbindd/winbindd_dual.c
index d200cfc..6a8601d 100644
--- a/source/winbindd/winbindd_dual.c
+++ b/source/winbindd/winbindd_dual.c
@@ -1177,7 +1177,8 @@ static bool fork_domain_child(struct winbindd_child *child)
 	state.sock = fdpair[0];
 	close(fdpair[1]);
 
-	if (!reinit_after_fork(winbind_messaging_context(), true)) {
+	if (!reinit_after_fork(winbind_messaging_context(),
+			       winbind_event_context(), true)) {
 		DEBUG(0,("reinit_after_fork() failed\n"));
 		_exit(0);
 	}
@@ -1219,27 +1220,34 @@ static bool fork_domain_child(struct winbindd_child *child)
 	messaging_register(winbind_messaging_context(), NULL,
 			   MSG_DEBUG, debug_message);
 
+	primary_domain = find_our_domain();
+
+	if (primary_domain == NULL) {
+		smb_panic("no primary domain found");
+	}
+	/* we have destroy all time event in reinit_after_fork()
+	 * set check_online_event to NULL */
+	for (domain = domain_list(); domain; domain = domain->next) {
+		domain->check_online_event = NULL;
+	}
+	/* It doesn't matter if we allow cache login,
+	 * try to bring domain online after fork. */
 	if ( child->domain ) {
 		child->domain->startup = True;
 		child->domain->startup_time = time(NULL);
-	}
-
-	/* Ensure we have no pending check_online events other
-	   than one for this domain or the primary domain. */
-
-	for (domain = domain_list(); domain; domain = domain->next) {
-		if (domain->primary) {
-			primary_domain = domain;
-		}
-		if ((domain != child->domain) && !domain->primary) {
-			TALLOC_FREE(domain->check_online_event);
+		/* we can be in primary domain or in trusted domain
+		 * If we are in trusted domain, set the primary domain
+		 * in start-up mode */
+		if (!(child->domain->internal)) {
+			set_domain_online_request(child->domain);
+			if (!(child->domain->primary)) {
+				primary_domain->startup = True;
+				primary_domain->startup_time = time(NULL);
+				set_domain_online_request(primary_domain);
+			}
 		}
 	}
 
-	if (primary_domain == NULL) {
-		smb_panic("no primary domain found");
-	}
-
 	/* Ensure we're not handling an event inherited from
 	   our parent. */
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list