Jelmer Vernooij jelmer at
Fri Feb 21 10:43:00 GMT 2003

090156 < metze> ctrlsoft: I think the modules stuff should not merged into 3_0 untill
we have discused how module loading should be finally done in samba

What I will be merging into 3_0 at first is just some basic helper
functions for the modules. it's currently only the smb_load_module() 
function that we need, no matter what way the modules system will

Here's an email I sent to the samba-team list about a week ago:


There has been some discussion whether modules should be implicitly
loaded. Here's a list of possibilities and their (dis)advantages that
I'm aware of:

1. Load all modules when samba starts:
+ No performance loss whenever a client connects
- New modules are not loaded when smb.conf changes
+ No need for other subsystems to know about modules. They just
  need to provide a smb_register_blah() function

2. Load all modules when a client connects
- Performance loss. We need to do dlopen(), dlsym(),
  init_module() for all modules we eventually might need whenever a client
+ If smb.conf changes, then every new client gets the new
  set of modules
- this won't be possible with nmbd
+ No need for other subsystems to know about
  modules. They just need to provide a smb_register_blah() function

3. Load the modules whenever they're needed
+- Not all modules need to be loaded at
   fork(). Performance
   will be better than in case (2) but worse
   than in case (1)
+ Changes to smb.conf are followed, even
  when smb.conf
  changed after the smbd child fork()'ed
- Subsystems need to know about
  modules. Whenever they need to
  use stuff from some module, they
  need to ensure that module
  is loaded.

I personally prefer either the second or the third method. There might 
be a little bit performance loss in the second case (dlopen(), dlsym(), 
init_module() calls). I don't think this will be very heavy, though.  
Doing 20000 dlopen() + dlsym() + init_module() + dlclose()'s
only took 5s on my Pentium 350 (These benchmarks aren't accurate because 
the kernel will map the module in the memory here, but there will be
usually more then one smbd	 running which means the module would
also be in the memory in normal cases).

What do you think? Any suggestions?


Jelmer Vernooij <jelmer at> -
11:37:40 up 4 days, 15:16, 19 users,  load average: 2.57, 1.36, 0.67

More information about the samba-technical mailing list