[SCM] Samba Shared Repository - branch master updated

Bo Yang boyang at samba.org
Mon Feb 8 01:48:56 MST 2010


The branch, master has been updated
       via  9fed901... s3: Don't invalidate cache for uninitialized domains.
       via  8c8bb51... s3: signals are processed twice in child.
      from  2aff1d6... s3: quiet the unresolved symbol warnings of the Compaq compiler when linking our vfs modules

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


- Log -----------------------------------------------------------------
commit 9fed9011ffcd76c5a5dbf16f7d5e657b94f9fa50
Author: Bo Yang <boyang at samba.org>
Date:   Tue Feb 9 16:35:40 2010 +0800

    s3: Don't invalidate cache for uninitialized domains.
    
    Signed-off-by: Bo Yang <boyang at samba.org>

commit 8c8bb51de1ac2baa46ac0736fae12c034288e5d4
Author: Bo Yang <boyang at samba.org>
Date:   Tue Feb 9 17:02:20 2010 +0800

    s3: signals are processed twice in child.
    
    Signed-off-by: Bo Yang <boyang at samba.org>

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

Summary of changes:
 lib/tevent/tevent.c               |    7 +++++++
 lib/tevent/tevent_internal.h      |    1 +
 lib/tevent/tevent_signal.c        |   33 ++++++++++++++++++++++++++++-----
 source3/winbindd/winbindd.c       |   25 ++++++++++++++++++++++++-
 source3/winbindd/winbindd_cache.c |   27 +++++++++++++++++++++++++++
 source3/winbindd/winbindd_proto.h |    1 +
 6 files changed, 88 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index 56d0da3..a0ee208 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -176,6 +176,13 @@ int tevent_common_context_destructor(struct tevent_context *ev)
 		sn = se->next;
 		se->event_ctx = NULL;
 		DLIST_REMOVE(ev->signal_events, se);
+		/*
+		 * This is important, Otherwise signals
+		 * are handled twice in child. eg, SIGHUP.
+		 * one added in parent, and another one in
+		 * the child. -- BoYang
+		 */
+		tevent_cleanup_pending_signal_handlers(se);
 	}
 
 	return 0;
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index e10f52e..7f5fd64 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -299,6 +299,7 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev,
 					       const char *handler_name,
 					       const char *location);
 int tevent_common_check_signal(struct tevent_context *ev);
+void tevent_cleanup_pending_signal_handlers(struct tevent_signal *se);
 
 bool tevent_standard_init(void);
 bool tevent_select_init(void);
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c
index 0f3d83e..45f65cf 100644
--- a/lib/tevent/tevent_signal.c
+++ b/lib/tevent/tevent_signal.c
@@ -133,7 +133,9 @@ static void tevent_common_signal_handler_info(int signum, siginfo_t *info,
 
 static int tevent_common_signal_list_destructor(struct tevent_common_signal_list *sl)
 {
-	DLIST_REMOVE(sig_state->sig_handlers[sl->se->signum], sl);
+	if (sig_state->sig_handlers[sl->se->signum]) {
+		DLIST_REMOVE(sig_state->sig_handlers[sl->se->signum], sl);
+	}
 	return 0;
 }
 
@@ -154,12 +156,16 @@ static int tevent_signal_destructor(struct tevent_signal *se)
 
 	if (sig_state->sig_handlers[se->signum] == NULL) {
 		/* restore old handler, if any */
-		sigaction(se->signum, sig_state->oldact[se->signum], NULL);
-		sig_state->oldact[se->signum] = NULL;
+		if (sig_state->oldact[se->signum]) {
+			sigaction(se->signum, sig_state->oldact[se->signum], NULL);
+			sig_state->oldact[se->signum] = NULL;
+		}
 #ifdef SA_SIGINFO
 		if (se->sa_flags & SA_SIGINFO) {
-			talloc_free(sig_state->sig_info[se->signum]);
-			sig_state->sig_info[se->signum] = NULL;
+			if (sig_state->sig_info[se->signum]) {
+				talloc_free(sig_state->sig_info[se->signum]);
+				sig_state->sig_info[se->signum] = NULL;
+			}
 		}
 #endif
 	}
@@ -398,3 +404,20 @@ int tevent_common_check_signal(struct tevent_context *ev)
 
 	return 1;
 }
+
+void tevent_cleanup_pending_signal_handlers(struct tevent_signal *se)
+{
+	struct tevent_common_signal_list *sl;
+	sl = talloc_get_type(se->additional_data,
+			     struct tevent_common_signal_list);
+
+	tevent_common_signal_list_destructor(sl);
+
+	if (sig_state->sig_handlers[se->signum] == NULL) {
+		if (sig_state->oldact[se->signum]) {
+			sigaction(se->signum, sig_state->oldact[se->signum], NULL);
+			sig_state->oldact[se->signum] = NULL;
+		}
+	}
+	return;
+}
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index c0b42b8..e4c22a6 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -141,6 +141,29 @@ static void flush_caches(void)
 	}
 }
 
+static void flush_caches_noinit(void)
+{
+	/*
+	 * We need to invalidate cached user list entries on a SIGHUP
+         * otherwise cached access denied errors due to restrict anonymous
+         * hang around until the sequence number changes.
+	 * NB
+	 * Skip uninitialized domains when flush cache.
+	 * If domain is not initialized, it means it is never
+	 * used or never become online. look, wcache_invalidate_cache()
+	 * -> get_cache() -> init_dc_connection(). It causes a lot of traffic
+	 * for unused domains and large traffic for primay domain's DC if there
+	 * are many domains..
+	 */
+
+	if (!wcache_invalidate_cache_noinit()) {
+		DEBUG(0, ("invalidating the cache failed; revalidate the cache\n"));
+		if (!winbindd_cache_validate_and_initialize()) {
+			exit(1);
+		}
+	}
+}
+
 /* Handle the signal by unlinking socket and exiting */
 
 static void terminate(bool is_parent)
@@ -254,7 +277,7 @@ static void winbindd_sig_hup_handler(struct tevent_context *ev,
 	const char *file = (const char *)private_data;
 
 	DEBUG(1,("Reloading services after SIGHUP\n"));
-	flush_caches();
+	flush_caches_noinit();
 	reload_services_file(file);
 }
 
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index a9690ae..0e17253 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -3023,6 +3023,33 @@ bool wcache_invalidate_cache(void)
 	return true;
 }
 
+bool wcache_invalidate_cache_noinit(void)
+{
+	struct winbindd_domain *domain;
+
+	for (domain = domain_list(); domain; domain = domain->next) {
+		struct winbind_cache *cache;
+
+		/* Skip uninitialized domains. */
+		if (!domain->initialized && !domain->internal) {
+			continue;
+		}
+
+		cache = get_cache(domain);
+
+		DEBUG(10, ("wcache_invalidate_cache: invalidating cache "
+			   "entries for %s\n", domain->name));
+		if (cache) {
+			if (cache->tdb) {
+				tdb_traverse(cache->tdb, traverse_fn, NULL);
+			} else {
+				return false;
+			}
+		}
+	}
+	return true;
+}
+
 bool init_wcache(void)
 {
 	if (wcache == NULL) {
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h
index f6c4dad..d3371b2 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -104,6 +104,7 @@ NTSTATUS wcache_save_creds(struct winbindd_domain *domain,
 void wcache_invalidate_samlogon(struct winbindd_domain *domain, 
 				struct netr_SamInfo3 *info3);
 bool wcache_invalidate_cache(void);
+bool wcache_invalidate_cache_noinit(void);
 bool init_wcache(void);
 bool initialize_winbindd_cache(void);
 void close_winbindd_cache(void);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list