1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

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 <mallik@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
This commit is contained in:
Roopa Prabhu
2016-02-29 15:31:52 -08:00
parent fc7e1fa2cc
commit 09b1b7fb0f

View File

@@ -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