Bug 5588 - smbd 100% CPU usage, strace reveals calls to GETDENTS
Summary: smbd 100% CPU usage, strace reveals calls to GETDENTS
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: File Services (show other bugs)
Version: 3.0.28a
Hardware: x64 Linux
: P3 major
Target Milestone: none
Assignee: Samba Bugzilla Account
QA Contact: Samba QA Contact
Depends on:
Reported: 2008-07-05 14:34 UTC by Charles Burns
Modified: 2020-05-17 19:17 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Charles Burns 2008-07-05 14:34:05 UTC
I have samba running on a Ubuntu 8.04.1 server kernel 2.6.24. While copying about 30,000 files (358MB total) from a Samba share to an MS Vista SP1 system.

The files are a backup of the /var, /etc, and a few other directories, from a backup of an old RH9 server.

Once the copying begins, CPU usage immediately climbs to 100% on both cores, transfer rate slows to a crawl or stops, and the CPU remains at 100% even after the copy is canceled. Restarting Samba corrects the problem, but it returns on next attempt at copying files. Copying a different file from the same share (a large one) works fine, gets about 24MB/sec and has Samba using about 2% CPU.


Hardware: Intel Core2, Intel Pro/1000 NIC (integrated), Intel® 3010 (Mukilteo-2P) chipset on Supermicro PDSME+, LSI SAS1068 RAID controller (Maxtor Atlas 10KV SAS drives, all non-RAID, all pass SMART)


strace -p 19343 -cfqrT
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 98.36    0.459465           0   7285071           getdents
  1.02    0.004762           0    141449           brk
  0.17    0.000796           0     24428           read
  0.16    0.000759           0     12216           write
  0.15    0.000697           0     12214           select
  0.07    0.000307           0     14983           open
  0.05    0.000241           0     30129     17974 stat
  0.01    0.000055           0     14984           close


Log files:

Logs do not seem to indicate a major problem. These are logs updated during the copy and the last few lines of their contents:


 tail log.charles-desktop
[2008/07/05 11:06:59, 0] auth/auth_util.c:create_builtin_administrators(792)
  create_builtin_administrators: Failed to create Administrators
[2008/07/05 11:06:59, 0] auth/auth_util.c:create_builtin_users(758)
  create_builtin_users: Failed to create Users
[2008/07/05 11:06:59, 1] smbd/service.c:make_connection_snum(1033)
  charles-desktop ( connect to service public initially as user charles (uid=1000, gid=1002) (pid 19343)
[2008/07/05 12:21:35, 1] smbd/service.c:close_cnum(1230)
  charles-desktop ( closed connection to service public
[2008/07/05 12:22:25, 1] smbd/service.c:make_connection_snum(1033)
  charles-desktop ( connect to service public initially as user charles (uid=1000, gid=1002) (pid 20102)

(Note I saw the master browser error while troubleshooting and added the first two lines (below) to the smb.conf, though it did not correct the error. I doubt it has much to do with the problem though).

 tail log.nmbd
[2008/07/05 12:22:10, 0] nmbd/nmbd_become_lmb.c:become_local_master_stage2(396)

  Samba name server SHERIDAN is now a local master browser for workgroup ALTERNET on subnet


[2008/07/05 12:22:10, 0] nmbd/nmbd_browsesync.c:find_domain_master_name_query_fail(351)
  Unable to find the Domain Master Browser name ALTERNET<1b> for the workgroup ALTERNET.
  Unable to sync browse lists in this workgroup.


My smb.conf; first the global portion, then the portion for the [public] share, from which I am copying the files. Other share configs omitted for brevity:

        local master = yes
        preferred master = yes
        wins support = yes
        netbios name = sheridan
        workgroup = ALTERNET
        announce version = 5.0
        security = user
        name resolve order = hosts wins bcast lmhosts
        dns proxy = no
        interfaces =
        bind interfaces only = true
        log file = /var/log/samba/log.%m
        max log size = 100000
        syslog = 0
        panic action = /usr/share/samba/panic-action %d
        encrypt passwords = true
        passdb backend = tdbsam
        obey pam restrictions = yes
        invalid users = root
        unix password sync = yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n *passwd:*password\supdated\ssuccessfully* .

[public]  # ReiserFS 3 filesystem
        comment = Public share
        path = /media/sdf1/public_share
        browsable = yes
        guest ok = no
        writable = yes
        force group = shares
        valid users = @shares
        write list = @shares


You can download a complete long file list ( ls -l ) here via HTTP:   (1MB, compressed)       (3MB)
Comment 1 Björn Jacke 2020-05-17 19:17:54 UTC
sorry for the lack of feedback here. If this happens with the latest 4.11 or 4.12 releases please file a new bug report for that.