From 09b1b7fb0f10a4693049d3d3d8e4941bd3860f43 Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Mon, 29 Feb 2016 15:31:52 -0800 Subject: [PATCH] start-networking: introduce state lock file /run/network/ifstatelock in non-persistant storage This is a reimport of missing peices of commit f819c3602e56 in 2.5cl ifupdown2. commit log from 2.5cl: Introduce a lock file in non-persistent storage /run/network/ifstatelock to make sure the state file in persistent storage is cleaned up correctly 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 Closes: CM-9573, CM-7774 Review: CCR-3623 (original review) Tested-by: Mallikarjuna rao Uppalapati Signed-off-by: Roopa Prabhu --- sbin/start-networking | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sbin/start-networking b/sbin/start-networking index 671c001..d9e1e02 100755 --- a/sbin/start-networking +++ b/sbin/start-networking @@ -6,7 +6,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 @@ -25,7 +28,7 @@ EXTRA_ARGS= perf_options() { # At bootup lets set perfmode - [ -f /var/tmp/network/ifstatenew ] && echo -n "" && return + [ -f ${IFSTATE_LOCKFILE} ] && echo -n "" && return echo -n "--perfmode" } @@ -97,6 +100,9 @@ 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