mirror of
				https://github.com/CumulusNetworks/ifupdown2.git
				synced 2024-05-06 15:54:50 +00:00 
			
		
		
		
	Introduce a lock file in non-persistent storage /run/network/ifstatelock
to make sure the state file in persistent storage is cleaned up correctly Ticket: CM-7774 Reviewed By: CCR-3623 Testing Done: Tested statefile accross reboots ifupdown2 state file was moved to /var/tmp because /var/tmp was tmpfs and was large enough (100MB) for the state file. But it appears it has changed (or is not consistent) across all platforms. We can move it under /run, but /run again size varies on various platforms and it is too small on some platforms. This patch: - continues to keep the ifupdown2 state file under /var/tmp (because it needs the space) - ntroduces a second level /run/network/ifstatelock file that stays on non-persistant storage and is used to delete the state file at /boot up
This commit is contained in:
		| @@ -11,7 +11,10 @@ | ||||
|  | ||||
| PATH="/sbin:/bin" | ||||
| RUN_DIR="/run/network" | ||||
| IFSTATE="$RUN_DIR/ifstate" | ||||
| IFSTATE_LOCKFILE="${RUN_DIR}/ifstatelock" | ||||
|  | ||||
| STATE_DIR="/var/tmp/network" | ||||
| IFSTATE_FILE="${STATE_DIR}/ifstatenew" | ||||
|  | ||||
| NAME=networking | ||||
| SCRIPTNAME=/etc/init.d/$NAME | ||||
| @@ -37,7 +40,7 @@ gen_examples() { | ||||
|     # | ||||
|  | ||||
|     # generate files only at boot | ||||
|     [ -f /var/tmp/network/ifstatenew ] && return | ||||
|     [ -f ${IFSTATE_LOCKFILE} ] && return | ||||
|  | ||||
|     python_ifupdown2_docdir="/usr/share/doc/python-ifupdown2" | ||||
|     swpfile=${python_ifupdown2_docdir}"/examples/swp_defaults" | ||||
| @@ -52,7 +55,7 @@ gen_examples() { | ||||
|  | ||||
| perf_options() { | ||||
|     # At bootup lets set perfmode | ||||
|     [ -f /var/tmp/network/ifstatenew ] && echo -n "" && return | ||||
|     [ -f ${IFSTATE_LOCKFILE} ] && echo -n "" && return | ||||
|  | ||||
|     echo -n "--perfmode" | ||||
| } | ||||
| @@ -124,6 +127,8 @@ ifup_hotplug () { | ||||
| } | ||||
|  | ||||
| ifupdown_init() { | ||||
|     	# remove state file at boot | ||||
| 	[ ! -e ${IFSTATE_LOCKFILE} ] && rm -f ${IFSTATE_FILE} | ||||
| 	[ ! -e /run/network ] && mkdir -p /run/network &>/dev/null | ||||
| 	[ ! -e /etc/network/run ] && \ | ||||
| 		ln -sf /run/network /etc/network/run &>/dev/null | ||||
|   | ||||
		Reference in New Issue
	
	Block a user