From 2630148dc7f93d43282c07a968a86e5a52bf2192 Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Wed, 25 Jan 2012 12:18:51 +0800 Subject: [PATCH] Handle rootfs correctly --- kexec-tools.spec | 5 ++++- mkdumprd | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/kexec-tools.spec b/kexec-tools.spec index b3142d9..19e5fe8 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.3 -Release: 32%{?dist} +Release: 33%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component. @@ -289,6 +289,9 @@ done %changelog +* Wed Jan 25 2012 Cong Wang - 2.0.2-33 +- Handle rootfs correctly. + * Tue Jan 10 2012 Cong Wang - 2.0.2-32 - Fix add_dracut_arg in mkdumprd. diff --git a/mkdumprd b/mkdumprd index d621f00..890acaa 100644 --- a/mkdumprd +++ b/mkdumprd @@ -65,6 +65,10 @@ to_dev_name() { echo $dev } +get_rootdev() { + mount | grep 'on / ' | grep -v rootfs | awk '{print $1}' +} + to_mount() { local _dev=$(to_dev_name $1) echo "$(grep "$_dev" /proc/mounts | cut -d' ' -f1-4)" @@ -75,6 +79,7 @@ check_remote() { return } +add_dracut_mount "$(to_mount "$(get_rootdev)")" if [ -n "$conf_file" ]; then while read config_opt config_val; do @@ -83,7 +88,16 @@ if [ -n "$conf_file" ]; then extra_modules="$extra_modules $config_val" ;; ext[234]|xfs|btrfs|minix) - add_dracut_mount "$(to_mount $config_val)" + _dev=$(to_dev_name "$config_val") + _mnt=$(to_mount "$config_val") + if [ "$_dev" = "$(get_rootdev)" ]; then + : + elif [ -n "$_mnt" ]; then + add_dracut_mount "$_mnt" + else + echo "Dump target $config_val is probably not mounted." + exit 1 + fi ;; raw) #TODO @@ -120,6 +134,7 @@ then fi dracut "${dracut_args[@]}" -M "$@" +_rc=$? sync -exit $? +exit $_rc