max_open_files

Benjamin Kuit bj at mcs.uts.edu.au
Sun Feb 7 14:59:17 GMT 1999


This might be a bug ..

samba/smbd/service.c

   617          init_structs();
   618
   619          if (!reload_services(False))
   620                  return(-1);

init_structs eventually has file_init() called, which uses
Globals.max_open_files to set real_max_open_files, a static
int in smbd/files.c.

The problem is that Globals.max_open_files is only set to
MAX_OPEN_FILES by init_globals, which is first (and only?)
called through reload_services(), the result is that
smbd/files.c:real_max_open_files is set to 0.

Surprisingly enough, on my system isn't stopping files being opened,
probably because the limit is set to maxfiles+FUDGEFACTOR and I'm not
using it in a large system, but it does cause a problem in the call
to file_new(), which has the calculation:

64      first_file = (getpid() ^ (int)time(NULL)) % real_max_open_files;

Since real_max_open_files = 0, the daemon dies of an Arithmetic Exception.

This was causing my roaming profile problem, and probably some others that
I was ignoring.

Bj

+-------------------------------+--------------------------------------+
|      Benjamin (Bj) Kuit       |  Faculty Of Mathematical             |
|      Systems Programmer       |          and Computing Sciences.     |
|      Phone: 02 9514 1841      |  University of Technology, Sydney    |
|      Mobile: 0412 182 972     |  bj at mcs.uts.edu.au                   |
+-------------------------------+--------------------------------------+


More information about the samba-technical mailing list