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

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