Blame SOURCES/0038-iscsi-nbd-do-not-try-to-mount-the-whole-disk-if-root.patch

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