summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-06-28 00:02:11 -0400
committerMike Frysinger <vapier@gentoo.org>2011-06-28 00:02:11 -0400
commitc427d3c1fec89f6a9281dccdc123bad73af80804 (patch)
tree8009cd3e41c889d0f7e1a37cdca5727aceb04be6 /net
parent24ba7955634dd571a4c34dd712dc8a592eea4d73 (diff)
downloadopenrc-c427d3c1fec89f6a9281dccdc123bad73af80804.tar.gz
openrc-c427d3c1fec89f6a9281dccdc123bad73af80804.tar.bz2
openrc-c427d3c1fec89f6a9281dccdc123bad73af80804.tar.xz
net: ccwgroup: smooth up/down process
We need to bring the link up ourselves after we've properly configured the device. The common code tries to bring the link up itself, but it does so before things are configured, and so it ends up failing. When shutting down, we need to wait for the kernel to finish destroying the interface. Otherwise, when doing a restart, openrc is quick enough to tell the kernel to destroy things, but then start trying to bring it back up before the kernel has finished. X-Gentoo-Bug: 367467 X-Gentoo-Bug-URL: http://bugs.gentoo.org/367467 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'net')
-rw-r--r--net/ccwgroup.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/ccwgroup.sh b/net/ccwgroup.sh
index 248b159..60cd25f 100644
--- a/net/ccwgroup.sh
+++ b/net/ccwgroup.sh
@@ -58,6 +58,11 @@ ccwgroup_pre_start()
echo "${val}" > /sys/devices/${ccw_type}/${first}/${var}
done
eend $?
+
+ # Now that we've properly configured the device, we can run
+ # bring the interface up. Common code tried to do this already,
+ # but it failed because we didn't setup sysfs yet.
+ _up
}
ccwgroup_pre_stop()
@@ -88,9 +93,14 @@ ccwgroup_post_stop()
local device="$(service_get_value ccwgroup_device)"
[ -z "${device}" ] && return 0
local ccw_type="$(service_get_value ccwgroup_type)"
+ local path="/sys/devices/${ccw_type}/${device}"
einfo "Disabling ccwgroup/${ccw_type} on ${IFACE}"
- echo "0" >/sys/devices/${ccw_type}/"${device}"/online
- echo "1" >/sys/devices/${ccw_type}/"${device}"/ungroup
+ if echo "0" >"${path}"/online &&
+ echo "1" >"${path}"/ungroup ; then
+ # The device doesn't disappear right away which breaks
+ # restart, or a quick start up, so wait around.
+ while [ -e "${path}" ] ; do :; done
+ fi
eend $?
}