File kdump-fadump-umount.patch of Package kdump

From: Petr Tesarik <ptesarik@suse.cz>
Subject: Clean up kdump mounts before continuing with FADUMP
References: bsc#923790
Patch-mainline: v0.8.16
Git-commit: 7ed4ad5cb04a21b7561b674fd312b246fe705d51

Before pivoting the root, the initramfs content is wiped. This cannot be
performed if there are still active mounts under /kdump, resulting in
kernel panic. If the system is correctly configured for FADUMP, it will
try to save a new dump from the panic after reboot, which fails the
same way and so on...

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
 init/save_dump.sh |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/init/save_dump.sh
+++ b/init/save_dump.sh
@@ -50,6 +50,14 @@ function handle_exit()
     if fadump_enabled; then
         # release memory if possible
         test -f $FADUMP_RELEASE_MEM && echo 1 > $FADUMP_RELEASE_MEM
+        # unmount kdump directories
+        dirs=
+        while read dev mp rest
+        do
+            test "${mp#$ROOTDIR}" = "${mp}" && continue
+            dirs="$mp $dirs"
+        done < /proc/mounts
+        umount $dirs
     elif [ $KDUMP_IMMEDIATE_REBOOT = "yes" \
             -o "$KDUMP_IMMEDIATE_REBOOT" = "YES" ] ; then
         umount -a
openSUSE Build Service is sponsored by