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

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