[PATCH] kdump-lib-initramfs: drop HOST_IP for local fs dump
by Joe Lawrence
Dump destination directory prefix "127.0.0.1" doesn't add any useful
information in the local dump_fs case. Remove it so that it agrees with
kdump.conf(5) documentation for <fs type> <partition> option, which states
the target directory format as "/mnt/var/crash/%DATE/".
Signed-off-by: Joe Lawrence <joe.lawrence(a)stratus.com>
Reported-by: Charlotte Richardson <charlotte.richardson(a)stratus.com>
---
kdump-lib-initramfs.sh | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 57b8304217cd..f657d836afa6 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -8,7 +8,6 @@ DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 1 -d 31"
DMESG_COLLECTOR="/sbin/vmcore-dmesg"
DEFAULT_ACTION="reboot"
DATEDIR=`date +%Y.%m.%d-%T`
-HOST_IP='127.0.0.1'
DUMP_INSTRUCTION=""
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
KDUMP_SCRIPT_DIR="/kdumpscripts"
@@ -87,6 +86,7 @@ dump_fs()
local _dev=$(findmnt -k -f -n -r -o SOURCE $1)
local _mp=$(findmnt -k -f -n -r -o TARGET $1)
+ local _dir=""
echo "kdump: dump target is $_dev"
@@ -95,19 +95,25 @@ dump_fs()
return 1
fi
+ if [ -z "$HOST_IP" ]; then
+ _dir="$_mp/$KDUMP_PATH/$DATEDIR"
+ else
+ _dir="$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR"
+ fi
+
# Remove -F in makedumpfile case. We don't want a flat format dump here.
[[ $CORE_COLLECTOR = *makedumpfile* ]] && CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e "s/-F//g"`
- echo "kdump: saving to $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
+ echo "kdump: saving to $_dir/"
mount -o remount,rw $_mp || return 1
- mkdir -p $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR || return 1
+ mkdir -p $_dir || return 1
- save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/"
+ save_vmcore_dmesg_fs ${DMESG_COLLECTOR} "$_dir/"
echo "kdump: saving vmcore"
- $CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete || return 1
- mv $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore
+ $CORE_COLLECTOR /proc/vmcore $_dir/vmcore-incomplete || return 1
+ mv $_dir/vmcore-incomplete $_dir/vmcore
sync
echo "kdump: saving vmcore complete"
--
1.7.10.4
9 years, 1 month
[PATCH] execute kdump_post after do_default_action
by Baoquan He
Someone complains that kdump_post script doesn't execute after mount
failed. This happened since mount failure will trigger
kdump-error-handler.service, and then start kdump-error-handler.sh.
However in kdump-error-handler.sh it doesn't execute kdump_post.
Hence add it in this patch.
Surely the function do_kdump_post need be moved into kdump-lib-initramfs.sh
to be a common function.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
dracut-kdump-error-handler.sh | 1 +
dracut-kdump.sh | 7 -------
kdump-lib-initramfs.sh | 7 +++++++
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/dracut-kdump-error-handler.sh b/dracut-kdump-error-handler.sh
index 2f0f1d1..c4372dc 100755
--- a/dracut-kdump-error-handler.sh
+++ b/dracut-kdump-error-handler.sh
@@ -7,4 +7,5 @@ export PATH=$PATH:$KDUMP_SCRIPT_DIR
get_kdump_confs
do_default_action
+do_kdump_post
do_final_action
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index e062665..fa8908f 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -35,13 +35,6 @@ do_kdump_pre()
fi
}
-do_kdump_post()
-{
- if [ -n "$KDUMP_POST" ]; then
- "$KDUMP_POST" "$1"
- fi
-}
-
add_dump_code()
{
DUMP_INSTRUCTION=$1
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 57b8304..9f26f6c 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -161,3 +161,10 @@ do_final_action()
{
eval $FINAL_ACTION
}
+
+do_kdump_post()
+{
+ if [ -n "$KDUMP_POST" ]; then
+ "$KDUMP_POST" "$1"
+ fi
+}
--
1.8.5.3
9 years, 1 month
[PATCH v2] dracut-moduel-setup: Filte the bind mounted directory in the Atomic
by Minfei Huang
The crash dump is saved in the /sysroot/crash directory, not the
/sysroot/var/crash in the atomic system.
On Atomic "findmnt /var" returns following.
bash-4.2# findmnt -k -n -r -o SOURCE /var
/dev/mapper/atomicos-root[/ostree/deploy/rhel-atomic-host/var]
Looks like first part is device and path inside brackets [] is path
which is source of bind mount.
So we can determine the bind mounted directory, if the "findmnt /var"
returns contains the brackets [].
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
kdump-lib.sh | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index a20c6e8..abd5467 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -86,9 +86,20 @@ get_root_fs_device()
return
}
+# We are looking to see if a part of dump path is mounted on some disk.
+# But we don't want to look for bind mounted directories. By default
+# df $path will show entries even if some part of path is bind mounted.
+# Also run findmnt to figure out if part of the $path is actuallly bind
+# mounted or real mount on some device.
get_mntpoint_from_path()
{
- echo $(df $1 | tail -1 | awk '{print $NF}')
+ local _mnt=$(df $1 | tail -1 | awk '{print $NF}')
+ _mnt=$(findmnt -k -n -r -o SOURCE $_mnt)
+ if `echo $_mnt | grep -q "\[.*\]"`; then
+ echo "/"
+ else
+ echo $_mnt
+ fi
}
get_target_from_path()
--
1.9.3
9 years, 1 month
[PATCH] dracut-moduel-setup.sh: Add the filter to verify the mount directory
by Minfei Huang
The crash dump is saved in the /sysroot/crash directory, not the
/sysroot/var/crash in the atomic system.
We will find the mount point by the command "df", if the directory is
mounted. But it is different between atomic system. "df /var/crash"
shows the "/var" is a mounted directory, but the "/var" is not a mounted
directory, for "df" command.
So add the filter to satisfy the mounted directory, that the mount point
will appear both "df" and "df $dir".
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
---
dracut-module-setup.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index ff7a088..b23de97 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -318,7 +318,10 @@ default_dump_target_install_conf()
_mntpoint=$(get_mntpoint_from_path $_save_path)
_target=$(get_target_from_path $_save_path)
- if [ "$_mntpoint" != "/" ]; then
+ # if the mount directory does not appear by the df command,
+ # the directory is not a mount directory,
+ # although the _mntpoint is "/", specified to the Atomic
+ if [ "$_mntpoint" != "/" ] && [ `df | grep "$_mntpoint" -q` ]; then
_fstype=$(get_fs_type_from_target $_target)
if $(is_fs_type_nfs $_fstype); then
--
1.9.3
9 years, 1 month