Blob Blame History Raw
From 65ba6c44d8f578a6fde7377cfcd7448202ba01e0 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 30 Oct 2013 17:36:54 +0100
Subject: [PATCH] iscsi/nbd: do not try to mount the whole disk, if root= is
 missing

only mount the whole disk for root=dhcp
---
 modules.d/95iscsi/iscsiroot.sh | 11 ++---------
 modules.d/95nbd/nbdroot.sh     |  2 +-
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 5181f52..738fff4 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -40,14 +40,6 @@ modprobe crc32c 2>/dev/null
 [ -e /sys/module/bnx2i ] && iscsiuio
 
 if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
-    if [ -z "$root" -o -n "${root%%block:*}" ]; then
-        # if root is not specified try to mount the whole iSCSI LUN
-        printf 'ENV{DEVTYPE}!="partition", SYMLINK=="disk/by-path/*-iscsi-*-*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-iscsi-root.rules
-        udevadm control --reload
-        write_fs_tab /dev/root
-        wait_for_dev /dev/root
-    fi
-
     for p in $(getargs rd.iscsi.param -d iscsi_param); do
 	iscsi_param="$iscsi_param --param $p"
     done
@@ -55,6 +47,7 @@ if getargbool 0 rd.iscsi.firmware -d -y iscsi_firmware ; then
     iscsistart -b $iscsi_param
     echo 'started' > "/tmp/iscsistarted-iscsi"
     echo 'started' > "/tmp/iscsistarted-firmware"
+    need_shutdown
     exit 0
 fi
 
@@ -137,7 +130,7 @@ handle_netroot()
 
 # FIXME $iscsi_protocol??
 
-    if [ -z "$root" -o -n "${root%%block:*}" ]; then
+    if [ "$root" = "dhcp" ]; then
         # if root is not specified try to mount the whole iSCSI LUN
         printf 'SYMLINK=="disk/by-path/*-iscsi-*-%s", SYMLINK+="root"\n' $iscsi_lun >> /etc/udev/rules.d/99-iscsi-root.rules
         udevadm control --reload
diff --git a/modules.d/95nbd/nbdroot.sh b/modules.d/95nbd/nbdroot.sh
index 823da0e..2e9d917 100755
--- a/modules.d/95nbd/nbdroot.sh
+++ b/modules.d/95nbd/nbdroot.sh
@@ -97,7 +97,7 @@ done
 
 # If we didn't get a root= on the command line, then we need to
 # add the udev rules for mounting the nbd0 device
-if [ -z "$root" -o -n "${root%%block:*}" -o "$root" = "block:/dev/root" ]; then
+if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then
     printf 'KERNEL=="nbd0", ENV{DEVTYPE}!="partition", ENV{ID_FS_TYPE}=="?*", SYMLINK+="root"\n' >> /etc/udev/rules.d/99-nbd-root.rules
     udevadm control --reload
     type write_fs_tab >/dev/null 2>&1 || . /lib/fs-lib.sh