[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Jun 10 14:19:01 MDT 2010


The branch, master has been updated
       via  b5638a0... Don't use the autofree context for the globals. This causes child smbd's forked by modules to crash due to destructors being called (found when using the vfs_aio_fork module with smb2).
      from  405a0c5... s3:cleaunp reformatting for readability

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


- Log -----------------------------------------------------------------
commit b5638a05601ce8206a85c2f3625f8894ed0e0a6f
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 10 13:17:35 2010 -0700

    Don't use the autofree context for the globals. This causes child smbd's forked
    by modules to crash due to destructors being called (found when using the vfs_aio_fork
    module with smb2).
    
    Jeremy.

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

Summary of changes:
 source3/smbd/globals.c     |   14 ++++++++++++--
 source3/smbd/server.c      |    7 ++++++-
 source3/smbd/server_exit.c |    1 +
 3 files changed, 19 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 30a306e..3150b9f 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -125,7 +125,12 @@ struct smbd_server_connection *smbd_server_conn = NULL;
 struct messaging_context *smbd_messaging_context(void)
 {
 	if (smbd_msg_ctx == NULL) {
-		smbd_msg_ctx = messaging_init(talloc_autofree_context(),
+		/*
+		 * Note we MUST use the NULL context here, not the
+		 * autofree context, to avoid side effects in forked
+		 * children exiting.
+		 */
+		smbd_msg_ctx = messaging_init(NULL,
 					      procid_self(),
 					      smbd_event_context());
 	}
@@ -138,7 +143,12 @@ struct messaging_context *smbd_messaging_context(void)
 struct memcache *smbd_memcache(void)
 {
 	if (!smbd_memcache_ctx) {
-		smbd_memcache_ctx = memcache_init(talloc_autofree_context(),
+		/*
+		 * Note we MUST use the NULL context here, not the
+		 * autofree context, to avoid side effects in forked
+		 * children exiting.
+		 */
+		smbd_memcache_ctx = memcache_init(NULL,
 						  lp_max_stat_cache_size()*1024);
 	}
 	if (!smbd_memcache_ctx) {
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 184b613..a7297d6 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -50,7 +50,12 @@ int get_client_fd(void)
 struct event_context *smbd_event_context(void)
 {
 	if (!smbd_event_ctx) {
-		smbd_event_ctx = event_context_init(talloc_autofree_context());
+		/*
+		 * Note we MUST use the NULL context here, not the
+		 * autofree context, to avoid side effects in forked
+		 * children exiting.
+		 */
+		smbd_event_ctx = event_context_init(NULL);
 	}
 	if (!smbd_event_ctx) {
 		smb_panic("Could not init smbd event context");
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index 868cd67..3e0da3e 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -121,6 +121,7 @@ static void exit_server_common(enum server_exit_reason how,
 	TALLOC_FREE(smbd_server_conn);
 	TALLOC_FREE(smbd_msg_ctx);
 	TALLOC_FREE(smbd_event_ctx);
+	TALLOC_FREE(smbd_memcache_ctx);
 
 	if (how != SERVER_EXIT_NORMAL) {
 		int oldlevel = DEBUGLEVEL;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list