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>
This commit is contained in:
Mike Frysinger 2011-06-28 00:02:11 -04:00
parent 24ba795563
commit c427d3c1fe

View File

@ -58,6 +58,11 @@ ccwgroup_pre_start()
echo "${val}" > /sys/devices/${ccw_type}/${first}/${var} echo "${val}" > /sys/devices/${ccw_type}/${first}/${var}
done done
eend $? 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() ccwgroup_pre_stop()
@ -88,9 +93,14 @@ ccwgroup_post_stop()
local device="$(service_get_value ccwgroup_device)" local device="$(service_get_value ccwgroup_device)"
[ -z "${device}" ] && return 0 [ -z "${device}" ] && return 0
local ccw_type="$(service_get_value ccwgroup_type)" local ccw_type="$(service_get_value ccwgroup_type)"
local path="/sys/devices/${ccw_type}/${device}"
einfo "Disabling ccwgroup/${ccw_type} on ${IFACE}" einfo "Disabling ccwgroup/${ccw_type} on ${IFACE}"
echo "0" >/sys/devices/${ccw_type}/"${device}"/online if echo "0" >"${path}"/online &&
echo "1" >/sys/devices/${ccw_type}/"${device}"/ungroup 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 $? eend $?
} }