From 2a8f9213a4d945834271f23da538bd20310f90a1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jul 2007 05:16:19 +0000 Subject: r23700: pre-open the sam in the parent smbd. This has the effect of loading the schema. That stops us loading the schema for each new connection. In future I would prefer to share a lot more of our ldb contexts with children. That will require a larger piece of surgery. (This used to be commit ff41bdc350cf05c70c63effe30fe69e63181f088) --- source4/smb_server/smb_server.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source4/smb_server/smb_server.c') diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 4fbc428a42..33b2fc77a4 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -32,6 +32,7 @@ #include "system/network.h" #include "lib/socket/netif.h" #include "param/share.h" +#include "dsdb/samdb/samdb.h" static NTSTATUS smbsrv_recv_generic_request(void *private, DATA_BLOB blob) { @@ -192,6 +193,19 @@ static NTSTATUS smb_add_socket(struct event_context *event_context, return NT_STATUS_OK; } + +/* + pre-open some of our ldb databases, to prevent an explosion of memory usage + when we fork + */ +static void smbsrv_preopen_ldb(struct task_server *task) +{ + /* yes, this looks strange. It is a hack to preload the + schema. I'd like to share most of the ldb context with the + child too. That will come later */ + talloc_free(samdb_connect(task, NULL)); +} + /* open the smb server sockets */ @@ -220,6 +234,8 @@ static void smbsrv_task_init(struct task_server *task) if (!NT_STATUS_IS_OK(status)) goto failed; } + smbsrv_preopen_ldb(task); + return; failed: task_server_terminate(task, "Failed to startup smb server task"); -- cgit