From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: [PATCH] Refuse to start bridging with network root filesystem Date: Tue, 26 Jun 2007 12:47:19 +0100 Message-ID: <1182858440.7589.23.camel@blaa> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-t94pVwKGNkzcI4ksJ8fG" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org --=-t94pVwKGNkzcI4ksJ8fG Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, Since setting up bridging involves bringing down the network interface, bridging clearly isn't compatible with the likes of NFS or iSCSI root. The attached patch makes network-bridge try to detect either of these conditions and refuse to start, logging an error to syslog. Signed-off-by: Mark McLoughlin Thanks, Mark. --=-t94pVwKGNkzcI4ksJ8fG Content-Disposition: attachment; filename=xen-network-root.patch Content-Type: text/x-patch; name=xen-network-root.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit diff -r 3f76b2f76c2a tools/examples/network-bridge --- a/tools/examples/network-bridge Mon Jun 25 16:52:39 2007 +0100 +++ b/tools/examples/network-bridge Tue Jun 26 12:41:09 2007 +0100 @@ -172,9 +172,21 @@ show_status () { echo '============================================================' } +is_network_root () { + local rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' /etc/mtab) + local rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab) + + [[ "$rootfs" =~ "^nfs" ]] || [[ "$rootopts" =~ "_netdev" ]] && return 0 || return 1 +} + op_start () { if [ "${bridge}" = "null" ] ; then return + fi + + if is_network_root ; then + [ -x /usr/bin/logger ] && /usr/bin/logger "network-bridge: bridging not supported on network root; not starting" + return fi if link_exists "$pdev"; then --=-t94pVwKGNkzcI4ksJ8fG Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-t94pVwKGNkzcI4ksJ8fG--