On 12/18/14 at 02:07pm, Baoquan He wrote:
Steve found a bug. When mount a disk in /var and not specify path
in /etc/kdump.conf, the vmcore will be dumped into /var/crash of
that disk, but not /crash on that disk.
This is because when write the parsed path into /tmp/$$-kdump.conf
in default_dump_target_install_conf() of mkdumprd, it uses below
sed command. So if no path specified at all, this sed command won't
add it to /tmp/$$-kdump.conf. Then in 2nd kernel it will take default
path, namely "/var/crash" as path if no path in /etc/kdump.conf in
2nd kernel.
sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
In this patch add a judgement, if user specified path let's use sed
command to replace it with parsed path. Otherwise execute a echo
command to add the path:
echo "path $_path" >> /tmp/$$-kdump.conf
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
dracut-module-setup.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 793495a..10c561d 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -331,7 +331,11 @@ default_dump_target_install_conf()
echo "$_fstype $_target" >> /tmp/$$-kdump.conf
_path=${_save_path##"$_mntpoint"}
- sed -i -e "s#^path[[:space:]]\+$_save_path#path $_path#"
/tmp/$$-kdump.conf
+ if [ -n "$(get_option_value "path")" ]; then
+ sed -i -e "s#^path[[:space:]]\+$_save_path#path $_path#"
/tmp/$$-kdump.conf
+ else
+ echo "path $_path" >> /tmp/$$-kdump.conf
+ fi
Baoquan, seems above code is using $_path which is a path relative to mount point
in 2nd kernel $$-kdump.conf, so how about just dropping the sed line, use below instead:
1) delete original ^path line in /tmp/$$-kdump.conf
2) echo "path $_path" >> /tmp/$$-kdump.conf
It looks simple than original sed logic.
Thanks
Dave