712866
From 65ba6c44d8f578a6fde7377cfcd7448202ba01e0 Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Wed, 30 Oct 2013 17:36:54 +0100
712866
Subject: [PATCH] iscsi/nbd: do not try to mount the whole disk, if root= is
712866
 missing
712866
712866
only mount the whole disk for root=dhcp
712866
---
712866
 modules.d/95iscsi/iscsiroot.sh | 11 ++---------
712866
 modules.d/95nbd/nbdroot.sh     |  2 +-
712866
 2 files changed, 3 insertions(+), 10 deletions(-)
712866
712866
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
5c6c2a
index 5181f523..738fff44 100755
712866
--- a/modules.d/95iscsi/iscsiroot.sh
712866
+++ b/modules.d/95iscsi/iscsiroot.sh
712866
@@ -40,14 +40,6 @@ modprobe crc32c 2>/dev/null
712866
 [ -e /sys/module/bnx2i ] && iscsiuio
712866
 
712866
 if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
712866
-    if [ -z "$root" -o -n "${root%%block:*}" ]; then
712866
-        # if root is not specified try to mount the whole iSCSI LUN
712866
-        printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
712866
-        udevadm control --reload
712866
-        write_fs_tab /dev/root
712866
-        wait_for_dev /dev/root
712866
-    fi
712866
-
712866
     for p in $(getargs rd.iscsi.param -d iscsi_param); do
712866
 	iscsi_param="$iscsi_param --param $p"
712866
     done
712866
@@ -55,6 +47,7 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
712866
     iscsistart -b $iscsi_param
712866
     echo 'started' > "/tmp/iscsistarted-iscsi"
712866
     echo 'started' > "/tmp/iscsistarted-firmware"
712866
+    need_shutdown
712866
     exit 0
712866
 fi
712866
 
712866
@@ -137,7 +130,7 @@ handle_netroot()
712866
 
712866
 # FIXME $iscsi_protocol??
712866
 
712866
-    if [ -z "$root" -o -n "${root%%block:*}" ]; then
712866
+    if [ "$root" = "dhcp" ]; then
712866
         # if root is not specified try to mount the whole iSCSI LUN
712866
         printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
712866
         udevadm control --reload
712866
diff --git a/modules.d/95nbd/nbdroot.sh b/modules.d/95nbd/nbdroot.sh
5c6c2a
index 823da0ea..2e9d9174 100755
712866
--- a/modules.d/95nbd/nbdroot.sh
712866
+++ b/modules.d/95nbd/nbdroot.sh
712866
@@ -97,7 +97,7 @@ done
712866
 
712866
 # If we didn't get a root= on the command line, then we need to
712866
 # add the udev rules for mounting the nbd0 device
712866
-if [ -z "$root" -o -n "${root%%block:*}" -o "$root" = "block:/dev/root" ]; then
712866
+if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then
712866
     printf 'KERNEL=="nbd0", ENV{DEVTYPE}!="partition", ENV{ID_FS_TYPE}=="?*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-nbd-root.rules
712866
     udevadm control --reload
712866
     type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh