File kdump-fadump-keep-sysroot.patch of Package kdump.624

Date: Fri Sep 26 15:50:05 2014 +0200
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Keep /sysroot mount point if fadump is on
References: bsc#889192
Patch-mainline: v0.8.16
Git-commit: 4c1a5aac3df1e4ea2f0509c5b653083a02c1d4dc

As FADUMP uses the normal initrd, the system must be able to boot up
eventually, so normal mount points are required.

But mounting the same device twice may not be possible because of
conflicting mount options, so system root may not be mountable under
/kdump. In order to keep the kdump-specific mount point hierarchy,
convert any such mount to a bind mount from /sysroot.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>

---
 init/module-setup.sh |   20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -126,17 +126,33 @@ install() {
     kdump_map_mpath_wwid
     for_each_host_dev_and_slaves_all kdump_add_mpath_dev
 
+    # Convert system root mounts to bind mounts
+    if [ "$KDUMP_FADUMP" = "yes" ] ; then
+	local i line
+	for i in "${!fstab_lines[@]}"
+	do
+	    line=( ${fstab_lines[i]} )
+	    if [ "${line[1]%/*}" = "/kdump" ] ; then
+		fstab_lines[i]="/sysroot ${line[1]} none bind"
+	    fi
+	done
+    fi
+
     kdump_setup_files "$initdir" "$kdump_mpath_wwids"
 
     if dracut_module_included "systemd" ; then
-	rm -f "${initdir}/$systemdutildir"/system-generators/dracut-rootfs-generator
+	[ "$KDUMP_FADUMP" != yes ] && \
+	    rm -f "${initdir}/$systemdutildir"/system-generators/dracut-rootfs-generator
+
 	inst_simple /lib/kdump/save_dump.sh
 	inst_simple "$moddir/kdump-save.service" \
 	    "$systemdsystemunitdir"/kdump-save.service
 	ln_r "$systemdsystemunitdir"/kdump-save.service \
 	    "$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
     else
-	inst_hook mount 30 "$moddir/mount-kdump.sh"
+	[ "$KDUMP_FADUMP" != yes ] && \
+	    inst_hook mount 30 "$moddir/mount-kdump.sh"
+
 	inst_hook pre-pivot 90 /lib/kdump/save_dump.sh
     fi