diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2012-10-11 03:49:45 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2012-10-11 03:49:45 +0000 |
commit | 27984c0d2d920db177ec43de10991c50e143915a (patch) | |
tree | cf134612ef610b985030ad1aff486f912c0e01de /net | |
parent | 9a9c2acd8d0a44799c1c0199bf7e14640f6a86f3 (diff) |
net/bonding: subsume functionality for NFS booting
If the kernel is NFS-booting, it is critical that we don't down the
slave interfaces when we activate the bond. To do so will break the root
filesystem when networking is temporarily lost.
Reported-by: Walter <walter@pratyeka.org>
X-Gentoo-Bug: 428604
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=428604
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/bonding.sh | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/net/bonding.sh b/net/bonding.sh index 7097a4dd..67b0d9ba 100644 --- a/net/bonding.sh +++ b/net/bonding.sh @@ -4,6 +4,7 @@ bonding_depend() { before interface macchanger + program /sbin/ifconfig /bin/ifconfig } _config_vars="$_config_vars slaves" @@ -23,6 +24,9 @@ bonding_pre_start() eval primary="\$primary_${IFVAR}" unset primary_${IFVAR} + eval subsume="\$subsume_${IFVAR}" + unset subsume_${IFVAR} + [ -z "${slaves}" ] && return 0 @@ -84,15 +88,44 @@ bonding_pre_start() _exists true || return 1 done - # Must force the slaves to a particular state before adding them - for IFACE in ${slaves}; do - _delete_addresses - _down - done + # Unless we are subsuming an existing interface (NFS root), we down + # slave interfaces to work around bugs supposedly in some chipsets + # that cause failure to enslave from other states. + if [ -z "${subsume}" ]; then + for IFACE in ${slaves}; do + _delete_addresses + _down + done + fi ) - # now force the master to up - _up + # Now force the master to up + # - First test for interface subsume request (required for NFS root) + if [ -n "${subsume}" ]; then + einfo "Subsuming ${subsume} interface characteristics." + eindent + local oiface=${IFACE} + IFACE=${subsume} + local addr="$(_get_inet_address)" + einfo "address: ${addr}" + IFACE=${oiface} + unset oiface + eoutdent + # subsume (presumably kernel auto-)configured IP + ifconfig ${IFACE} ${addr} up + else + # warn if root on nfs and no subsume interface supplied + local root_fs_type=$(mountinfo -s /) + if [ "${root_fs_type}" == "nfs" ]; then + warn_nfs=1 + ewarn "NFS root detected!!!" + ewarn " If your system crashes here, /etc/conf.d/net needs" + ewarn " subsume_${IFACE}=\"<iface>\" ... where <iface> is the" + ewarn " existing, (usually kernel auto-)configured interface." + fi + # up the interface + _up + fi # finally add in slaves # things needed in the process, and if they are done by ifenslave, openrc, and/or the kernel. @@ -132,6 +165,11 @@ bonding_stop() { _is_bond || return 0 + # Wipe subsumed interface + if [ -n "${subsume}" ]; then + ifconfig ${subsume} 0.0.0.0 + fi + local slaves= s= slaves=$( \ sed -n -e 's/^Slave Interface: //p' "/proc/net/bonding/${IFACE}" \ |