Thanks a lot. Josef
----- Original Message ----- | From: "Robert Story" <rst...@freesnmp.com> | To: "Josef Ridky" <jri...@redhat.com> | Cc: net-snmp-coders@lists.sourceforge.net | Sent: Saturday, May 5, 2018 7:00:23 AM | Subject: Re: Configuration files are not resilient to power failure | | I've added a call to fsync in 5-7-patches and master. | | On Mon, 15 Jan 2018 04:18:57 -0500 (EST) Josef wrote: | JR> net-snmp's configuration files are not resilient to power | JR> failure. | JR> | JR> following a power failure event users created with | JR> net-snmp-create-v3-user are missing from /etc/snmp/snmpd.conf | JR> and that /var/lib/net-snmp/snmpd.conf is empty. | JR> | JR> Steps to Reproduce: | JR> | JR> [root@rhel73 ~]# cat /etc/fstab | JR> UUID=8c3e7419-f4b9-425a-b535-b6849a6e68bf / xfs defaults 0 0 | JR> [root@rhel73 ~]# grep | JR> testuser /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf | JR> [root@rhel73 ~]# ls | JR> -l /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf | JR> -rw-------. 1 root root 18891 Dec 4 22:32 /etc/snmp/snmpd.conf | JR> -rw-------. 1 root root 1073 Dec 5 | JR> 00:04 /var/lib/net-snmp/snmpd.conf | JR> | JR> [root@rhel73 ~]# systemctl stop snmpd | JR> [root@rhel73 ~]# /usr/bin/net-snmp-create-v3-user -A testpass | JR> testuser | JR> | JR> [root@rhel73 ~]# ls | JR> -l /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf | JR> -rw-------. 1 root root 18877 Dec 5 00:09 /etc/snmp/snmpd.conf | JR> -rw-------. 1 root root 1112 Dec 5 | JR> 00:09 /var/lib/net-snmp/snmpd.con [root@rhel73 ~]# grep | JR> testuser /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf | /etc/snmp/snmpd.conf:rwuser | JR> testuser /var/lib/net-snmp/snmpd.conf:createUser testuser MD5 | JR> "testpass" DES | JR> | JR> [root@rhel73 ~]# systemctl start snmpd | JR> | JR> Force power off and reconnect. | JR> | JR> [root@rhel73 ~]# grep | JR> testuser /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf | JR> [root@rhel73 ~]# ls | JR> -l /etc/snmp/snmpd.conf /var/lib/net-snmp/snmpd.conf | JR> -rw-------. 1 root root 18861 Dec 5 00:09 /etc/snmp/snmpd.conf | JR> -rw-------. 1 root root 0 Dec 5 | JR> 00:09 /var/lib/net-snmp/snmpd.conf | JR> | JR> Actual results: | JR> | JR> The added user has been lost from the configuration. | JR> The entire /var/lib/net-snmp/snmpd.conf has been lost. | JR> | JR> Expected results: | JR> | JR> /etc/snmp/snmpd.conf contains the newly added user. | JR> /var/lib/net-snmp/snmpd.conf is not destroyed. | JR> | JR> Additional info: | JR> | JR> This was observed for XFS root filesystems, it may be that | JR> the default Ext's data=ordered mode behaves differently. | JR> Running this under strace snmpd is doing a rename/rewrite of | JR> the file. But it never calls fsync, so for the XFS case the | JR> dirty buffers are still in memory when the box is powered off, | JR> only the rename and create have hit the disk. | ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders