This bug was fixed in the package net-snmp - 5.7.3+dfsg-5ubuntu3
---------------
net-snmp (5.7.3+dfsg-5ubuntu3) eoan; urgency=medium
* Skip autofs entries when calling statfs to prevent autofs being mounted on
snmpd startup (LP: #1835818):
- d/p/autofs-skip-autofs-entries.patch
- d/p/autofs-fix-a-recently-introduced-bug.patch
-- Ioanna Alifieraki <[email protected]> Wed, 21
Aug 2019 12:22:37 +0100
** Changed in: net-snmp (Ubuntu Eoan)
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of STS
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1835818
Title:
snmpd causes autofs mount points to be mounted on service
start/restart
Status in net-snmp package in Ubuntu:
Fix Released
Status in net-snmp source package in Xenial:
In Progress
Status in net-snmp source package in Bionic:
In Progress
Status in net-snmp source package in Cosmic:
Won't Fix
Status in net-snmp source package in Disco:
In Progress
Status in net-snmp source package in Eoan:
Fix Released
Status in net-snmp package in Debian:
Unknown
Bug description:
[Impact]
Autofs direct map triggers are visible in /etc/mtab.
On boot, when snmpd starts, it iterates over the entries in /etc/mtab and
performs statfs() on them.
This trigger automount to mount autofs mounts even if the user does not
explicitly access them.
However this happens only if autofs service is started before snmpd.
If snmpd stars first /etc/mtab is not yet populated with autofs mounts and
therefore
are not mounted.
When there a few autofs mount points the impact is insignificant.
However when there are thousands of them, this causes unnecessary overhead on
operations
such as df.
This also delays the system shutdown time since everything needs to be
unmounted.
[Test Case]
*** Test Case 1 - During boot:
The user that brought this issue to our attention would observe all autofs
mounts
be mounted at boot, because in their environment autofs would start first.
In my environment snmpd starts first so to reproduce I had to add a small
delay in
snmpd init script.
In /etc/init.d/snmp :
@@ -36,6 +36,8 @@ cd /
case "$1" in
start)
+ # Delay snmp start
+ sleep 2
log_daemon_msg "Starting SNMP services:"
# remove old symlink with previous version
if [ -L /var/run/agentx ]; then
$cat /etc/auto.master
/- /etc/auto.nfs --timeout=30
$cat /etc/auto.nfs
/home/test1 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp <NFS server
IP>:/srv/export/test1
/home/test2 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp <NFS server
IP>:/srv/export/test2
Reboot vm, syslog entries :
# Autofs starts
Jul 11 11:04:16 xenial-vm3 autofs[1295]: * Starting automount...
Jul 11 11:04:16 xenial-vm3 automount[1357]: Starting automounter version
5.1.1, master map /etc/auto.master
Jul 11 11:04:16 xenial-vm3 automount[1357]: using kernel protocol version 5.02
# Mount triggers, now visible in mtab
Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test1
with timeout 300, freq 75 seconds
Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test2
with timeout 300, freq 75 seconds
Jul 11 11:04:16 xenial-vm3 autofs[1295]: ...done.
...
# SNMP starts
Jul 11 11:04:18 xenial-vm3 snmpd[1294]: * Starting SNMP services:
Jul 11 11:04:18 xenial-vm3 systemd[1]: proc-sys-fs-binfmt_misc.automount: Got
automount request for /proc/sys/fs/binfmt_misc, triggered by 1394 (snmpd)
Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounting Arbitrary Executable File
Formats File System...
Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounted Arbitrary Executable File
Formats File System.
Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry
/home/test1 <==========
Jul 11 11:04:18 xenial-vm3 kernel: [ 8.880685] FS-Cache: Loaded
Jul 11 11:04:18 xenial-vm3 kernel: [ 8.889318] FS-Cache: Netfs 'nfs'
registered for caching
Jul 11 11:04:18 xenial-vm3 kernel: [ 8.902672] NFS: Registering the
id_resolver key type
Jul 11 11:04:18 xenial-vm3 kernel: [ 8.902680] Key type id_resolver
registered
Jul 11 11:04:18 xenial-vm3 kernel: [ 8.902682] Key type id_legacy
registered
Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test1 <==========
Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry
/home/test2 <==========
Jul 11 11:04:18 xenial-vm3 kernel: [ 9.163011] random: nonblocking pool is
initialized
Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test2 <===========
*** Test Case 2 - Restart snmpd :
To reproduce this case, autofs mounts should not be mounted to begin with.
(restart autofs or let it expire)
#systemctl restart snmpd.service
Syslog entries :
Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopping LSB: SNMP agents...
Jul 11 11:15:40 xenial-vm3 snmpd[1668]: * Stopping SNMP services:
Jul 11 11:15:40 xenial-vm3 snmpd[1434]: Received TERM or STOP signal...
shutting down...
Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopped LSB: SNMP agents.
Jul 11 11:15:40 xenial-vm3 systemd[1]: Starting LSB: SNMP agents...
Jul 11 11:15:42 xenial-vm3 snmpd[1677]: * Starting SNMP services:
Jul 11 11:15:42 xenial-vm3 automount[1357]: attempting to mount entry
/home/test1 <===========
Jul 11 11:15:42 xenial-vm3 automount[1357]: mounted /home/test1 <===========
Jul 11 11:15:42 xenial-vm3 automount[1357]: attempting to mount entry
/home/test2 <===========
Jul 11 11:15:42 xenial-vm3 automount[1357]: mounted /home/test2 <===========
Jul 11 11:15:42 xenial-vm3 snmpd[1684]: /etc/snmp/snmpd.conf: line 145:
Warning: Unknown token: defaultMonitors.
Jul 11 11:15:42 xenial-vm3 snmpd[1684]: /etc/snmp/snmpd.conf: line 147:
Warning: Unknown token: linkUpDownNotifications.
Jul 11 11:15:42 xenial-vm3 snmpd[1684]: Turning on AgentX master support.
Jul 11 11:15:42 xenial-vm3 systemd[1]: Started LSB: SNMP agents.
Jul 11 11:15:42 xenial-vm3 snmpd[1708]: NET-SNMP version 5.7.3
[Regression Potential]
The regression potential of these patch is low.
The patch essentially adds support for autofs mounts in order to detect them
and treat them separately when calling stafs; autofs entries are skipped to
prevent them from being mounting every time snmpd is restarted.
Therefore, any regression that may be caused by this patch will be autofs
related.
[Other]
Upstream bug : https://sourceforge.net/p/net-snmp/bugs/2968/
Upstream patches :
https://sourceforge.net/p/net-snmp/patches/1350/
https://sourceforge.net/p/net-snmp/code/ci/a0df31c18c513a0d79f4d526b1af7fad48748e57/
Debian Bug : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=935325
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/net-snmp/+bug/1835818/+subscriptions
--
Mailing list: https://launchpad.net/~sts-sponsors
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sts-sponsors
More help : https://help.launchpad.net/ListHelp