Executing systemctl daemon-reload freezes entire system for a few seconds
Applies to:
Linux
Symptoms
Performing the following command in Oracle Linux 7 using Unbreakable Enterprise Kernel (UEK) 4/5/6 takes several seconds to complete:
# time sudo /usr/bin/systemctl daemon-reload real 0m11.726s user 0m0.014s sys 0m0.024s
During this time, the system appears to freeze and all other commands also stall until the daemon-reload process completes.
No errors or warnings can be seen in the system logs and no observable performance degradation.
Cause
This is caused by a high number (several millions) of negative dentries in the system cache.
# cat /proc/sys/fs/dentry-state 16096712 15973922 45 0 0 0
The first number reveals the total number of directory cache entries, while the second number displays the number of unused entries. The third number shows the number of seconds between when a file has been freed and when it can be reclaimed, and the fourth measures the entries currently requested by the system. The last two columns are not used.