logrotate script needs to notify all samba processes when logs are rotated
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
samba (Ubuntu) |
Confirmed
|
Medium
|
Unassigned |
Bug Description
After the log rotation, logrotate needs to notify all samba processes to release their open file descriptors on the log files.
The current logrotate configuration file does not do so and only notify the process that has it's PID stored /var/run/samba/.
This is wrong as other child will keep logging to the "deleted" files and may use all the disk space. Those "deleted" files are not showing in ls output but they are still consuming space in the file system.
I think the right solution to this bug would be to have logrotate to call "smbcontrol all reload-config". This solution was proposed by Andrew Bartlett, a Samba developer, in this email http://
I have confirmed that this problem affects Samba from Lucid to Natty at least.
description: | updated |
Changed in samba (Ubuntu): | |
importance: | Undecided → Medium |
status: | New → Confirmed |
tags: | added: server-next-drop |
tags: | removed: server-next server-next-drop |
Steps to observe the problem :
# Only one log file exists
ls -1 /var/log/samba
cores
log.smbd
# Force the rotation d/samba
logrotate -f /etc/logrotate.
# The log is rotated but the old log file is missing (was rm'ed and does not show in ls)
ls -1 /var/log/samba
cores
log.smbd.1.gz
# with lsof we see the renamed file still opened and deleted samba/log. smbd.1 (deleted) samba/log. smbd.1 (deleted) samba/log. smbd.1 (deleted) samba/log. smbd.1 (deleted)
lsof | grep log.smbd
smbd 6593 root 2w REG 251,1 524288000 783512 /var/log/
smbd 6593 root 27w REG 251,1 524288000 783512 /var/log/
smbd 6595 root 2w REG 251,1 343 783436 /var/log/
smbd 6595 root 8w REG 251,1 343 783436 /var/log/
# Instruct smbd to reopen the log file (as Natty's logrotate does) samba/smbd. pid`
kill -HUP `cat /var/run/
# Now the log.smbd finally appears
ls -1 /var/log/samba
cores
log.smbd
log.smbd.1.gz
# lsof still shows problems due to other children processes not knowing to release the log file samba/log. smbd samba/log. smbd samba/log. smbd.1 (deleted) samba/log. smbd.1 (deleted)
lsof | grep log.smbd
smbd 6593 root 2w REG 251,1 202 783521 /var/log/
smbd 6593 root 8w REG 251,1 202 783521 /var/log/
smbd 6595 root 2w REG 251,1 343 783436 /var/log/
smbd 6595 root 8w REG 251,1 343 783436 /var/log/
Using "smbcontrol all reload-config" in the logrotate configuration file fixes the issue.