Comment 5 for bug 529290

Simon D├ęziel (sdeziel) wrote :

I don't know what status to assign to this bug but the current situation isn't good as smbd processes will keep logging to the old log file. All this logging will be lost as it ends up in a "deleted" log file. Another potentially bad consequence is that the server might run out of space because of this hidden log file that grows without bounds.

Steps to observe the problem :

# Only one log file exists
ls /var/log/samba
cores log.smbd

# Force the rotation
logrotate -f /etc/logrotate.d/samba

# The log is rotated but the old log file is missing (was rm'ed but does not show in ls)
ls /var/log/samba
cores log.smbd.1.gz

# with lsof
lsof | grep log.smbd
smbd 6593 root 2w REG 251,1 524288000 783512 /var/log/samba/log.smbd.1 (deleted)
smbd 6593 root 27w REG 251,1 524288000 783512 /var/log/samba/log.smbd.1 (deleted)
smbd 6595 root 2w REG 251,1 343 783436 /var/log/samba/log.smbd.1 (deleted)
smbd 6595 root 8w REG 251,1 343 783436 /var/log/samba/log.smbd.1 (deleted)

# Instruct smbd to reopen the log file
kill -HUP `cat /var/run/samba/smbd.pid`

# Now the log.smbd finally appears
ls /var/log/samba
cores log.smbd log.smbd.1.gz

# lsof still shows problems
lsof | grep log.smbd
smbd 6593 root 2w REG 251,1 202 783521 /var/log/samba/log.smbd
smbd 6593 root 8w REG 251,1 202 783521 /var/log/samba/log.smbd
smbd 6595 root 2w REG 251,1 343 783436 /var/log/samba/log.smbd.1 (deleted)
smbd 6595 root 8w REG 251,1 343 783436 /var/log/samba/log.smbd.1 (deleted)

Maybe the solution is to use pkill -HUP smbd to notify all children to reopen the log file.