[Samba] Failed to init inotify - Too many open files

Meike Stone meike.stone at googlemail.com
Wed Jun 10 07:47:01 MDT 2015


Hello,

I've a problem on my system with inotify.

In the smbd logfile are shown a lot messages like this:

[2015/06/10 11:15:21.644453,  0, pid=57030, effective(12700, 100),
real(0, 0)] smbd/notify_inotify.c:297(inotify_setup) Failed to init
inotify - Too many open files
[2015/06/10 11:15:23.968497,  0, pid=57030, effective(12700, 100),
real(0, 0)] smbd/notify_inotify.c:297(inotify_setup) Failed to init
inotify - Too many open files
[2015/06/10 11:15:24.192444,  0, pid=57030, effective(12700, 100),
real(0, 0)] smbd/notify_inotify.c:297(inotify_setup) Failed to init
inotify - Too many open files
[2015/06/10 11:15:28.616495,  0, pid=57030, effective(12700, 100),
real(0, 0)] smbd/notify_inotify.c:297(inotify_setup) Failed to init
inotify - Too many open files

I can't find the reason, why smbd ist complaining. But in the source code, I see

    in->fd = inotify_init();
    if (in->fd == -1) {
        DEBUG(0,("Failed to init inotify - %s\n", strerror(errno)));
        talloc_free(in);
        return map_nt_error_from_unix(errno);
    }

it is nothing special from smbs/samba. But why the kernel throws this message?

Here a little bit about samba and the system:
=============================================

* The samba version is 3.6.25
* Used by about 1000 users
* Linux kernel 3.0.101-0.46 64bit (SLES11SP3)

* Inotify configuration from system:
  ----------------------------------
# sysctl -a | grep inotify
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 65536


* The samba config:
-------------------

[global]
    workgroup = Samba
    map to guest = Bad User
    security = user
    server string = FILESERVER

    load printers = no
    printcap name = /dev/null
    disable spoolss = yes

    ldap admin dn = uid=samba_admin,o=company,c=net
    passdb backend = ldapsam:"ldap://ldap01.company.net
ldap://ldap01.company.net"
    ldap suffix = cn=samba,o=company,c=net
    ldap user suffix = cn=accounts
    ldap group suffix = cn=groups
    ldap passwd sync = No

    unix extensions = no
    follow symlinks = yes
    wide links = yes

    vfs objects = extd_audit
    debug uid = yes
    debug pid = yes
    debug class = yes
    log level = 0 vfs:2
    syslog = 0
    max log size = 1024
    log file = /var/log/smbduserlogs/%U.log

[DATA]
    path = /data
    comment = share
    writeable = yes
    browseable = no
    nt acl support = no
    inherit permissions = yes
    store dos attributes = yes



* To check the system status regarding samba and inotify I let run
   by cron following script at every 5 minutes
------------------------------------------------------------------
#!/bin/sh
LOG_FILE="/tmp/inotify.log"
d=$(date +"%c")
echo -e "\n $d ===================" >>$LOG_FILE
find /proc/*/fd/* -type l -lname 'anon_inode:inotify' 2>/dev/null |
cut -f 1-3 -d'/' | uniq -c | sort -n >>$LOG_FILE
ps -eLf >>$LOG_FILE
smbstatus >>$LOG_FILE

I never got processes with more then 10 inotify file descriptors ..


If I look to the limits from a "complaining processes" I see nothing "wrong":
# cat /proc/57030/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        16777216             unlimited            bytes
Max resident set          57507328000          unlimited            bytes
Max processes             516081               516081               processes
Max open files            16404                16404                files
Max locked memory         65536                262144               bytes
Max address space         57559531520          unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       516081               516081               signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us


Tracing the syscall inotify_init() via ftrace is not possible, because
the kernel
was not compiled with CONFIG_FUNCTION_TRACER.


Can anyone help me?


Thanks Meike


More information about the samba mailing list