From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 57E0F138200 for ; Thu, 11 Oct 2012 03:57:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 739D921C017; Thu, 11 Oct 2012 03:57:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B92C621C014 for ; Thu, 11 Oct 2012 03:57:15 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F3CE133D7D4 for ; Thu, 11 Oct 2012 03:57:14 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 9C361E5436 for ; Thu, 11 Oct 2012 03:57:12 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: <1349927385.27984c0d2d920db177ec43de10991c50e143915a.robbat2@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: net/ X-VCS-Repository: proj/openrc X-VCS-Files: net/bonding.sh X-VCS-Directories: net/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: 27984c0d2d920db177ec43de10991c50e143915a X-VCS-Branch: master Date: Thu, 11 Oct 2012 03:57:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 6f423e04-7994-4fc6-90fe-ceeb7911a539 X-Archives-Hash: 1c91aac1934ba13d577966d9ce131a05 commit: 27984c0d2d920db177ec43de10991c50e143915a Author: Robin H. Johnson gentoo org> AuthorDate: Thu Oct 11 03:49:45 2012 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Thu Oct 11 03:49:45 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=27984c0d 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 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 gentoo.org> --- net/bonding.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 45 insertions(+), 7 deletions(-) diff --git a/net/bonding.sh b/net/bonding.sh index 7097a4d..67b0d9b 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}=\"\" ... where 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}" \