All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark McLoughlin <markmc@redhat.com>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] Refuse to start bridging with network root filesystem
Date: Tue, 26 Jun 2007 12:47:19 +0100	[thread overview]
Message-ID: <1182858440.7589.23.camel@blaa> (raw)

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

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 <markmc@redhat.com>

Thanks,
Mark.

[-- Attachment #2: xen-network-root.patch --]
[-- Type: text/x-patch, Size: 886 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2007-06-26 11:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1182858440.7589.23.camel@blaa \
    --to=markmc@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.