1 |
commit: c427d3c1fec89f6a9281dccdc123bad73af80804 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jun 28 04:02:11 2011 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jun 28 04:02:11 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=c427d3c1 |
7 |
|
8 |
net: ccwgroup: smooth up/down process |
9 |
|
10 |
We need to bring the link up ourselves after we've properly configured |
11 |
the device. The common code tries to bring the link up itself, but it |
12 |
does so before things are configured, and so it ends up failing. |
13 |
|
14 |
When shutting down, we need to wait for the kernel to finish destroying |
15 |
the interface. Otherwise, when doing a restart, openrc is quick enough |
16 |
to tell the kernel to destroy things, but then start trying to bring it |
17 |
back up before the kernel has finished. |
18 |
|
19 |
X-Gentoo-Bug: 367467 |
20 |
X-Gentoo-Bug-URL: http://bugs.gentoo.org/367467 |
21 |
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org> |
22 |
|
23 |
--- |
24 |
net/ccwgroup.sh | 14 ++++++++++++-- |
25 |
1 files changed, 12 insertions(+), 2 deletions(-) |
26 |
|
27 |
diff --git a/net/ccwgroup.sh b/net/ccwgroup.sh |
28 |
index 248b159..60cd25f 100644 |
29 |
--- a/net/ccwgroup.sh |
30 |
+++ b/net/ccwgroup.sh |
31 |
@@ -58,6 +58,11 @@ ccwgroup_pre_start() |
32 |
echo "${val}" > /sys/devices/${ccw_type}/${first}/${var} |
33 |
done |
34 |
eend $? |
35 |
+ |
36 |
+ # Now that we've properly configured the device, we can run |
37 |
+ # bring the interface up. Common code tried to do this already, |
38 |
+ # but it failed because we didn't setup sysfs yet. |
39 |
+ _up |
40 |
} |
41 |
|
42 |
ccwgroup_pre_stop() |
43 |
@@ -88,9 +93,14 @@ ccwgroup_post_stop() |
44 |
local device="$(service_get_value ccwgroup_device)" |
45 |
[ -z "${device}" ] && return 0 |
46 |
local ccw_type="$(service_get_value ccwgroup_type)" |
47 |
+ local path="/sys/devices/${ccw_type}/${device}" |
48 |
|
49 |
einfo "Disabling ccwgroup/${ccw_type} on ${IFACE}" |
50 |
- echo "0" >/sys/devices/${ccw_type}/"${device}"/online |
51 |
- echo "1" >/sys/devices/${ccw_type}/"${device}"/ungroup |
52 |
+ if echo "0" >"${path}"/online && |
53 |
+ echo "1" >"${path}"/ungroup ; then |
54 |
+ # The device doesn't disappear right away which breaks |
55 |
+ # restart, or a quick start up, so wait around. |
56 |
+ while [ -e "${path}" ] ; do :; done |
57 |
+ fi |
58 |
eend $? |
59 |
} |