From c427d3c1fec89f6a9281dccdc123bad73af80804 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 28 Jun 2011 00:02:11 -0400 Subject: [PATCH] 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 --- net/ccwgroup.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/net/ccwgroup.sh b/net/ccwgroup.sh index 248b159d..60cd25fd 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 $? }