max_open_files

Todd Pfaff pfaff at edge.cis.McMaster.CA
Sun Feb 7 20:30:46 GMT 1999


On Mon, 8 Feb 1999, Benjamin Kuit wrote:

> This might be a bug ..

what version of samba?

> 
> samba/smbd/service.c

smbd/server.c?

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

code is different in 2.0.2.  smbd/server.c, line 625-:

        if (!reload_services(False))
                return(-1);

        init_structs();

> 
> 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                   |
> +-------------------------------+--------------------------------------+
> 

--
Todd Pfaff                         \  Email: pfaff at mcmaster.ca
Computing and Information Services  \ Voice: (905) 525-9140 x22920
ABB 132                              \  FAX: (905) 528-3773
McMaster University                   \
Hamilton, Ontario, Canada  L8S 4M1     \



More information about the samba-technical mailing list