Don't mount the dump target unless needed
For fadump, this helps to reduce the risk of boot failure, and may also help speed up the boot by a bit. For normal kdump, this will delay the dump target mounting, and no longer depend on systemd to do the mounting job. And currently there is a failure that caused by some mount handling bug with kernel and systemd that is failing the system booting: [FAILED] Failed to mount /kdumproot/home. See 'systemctl status kdumproot-home.mount' for details. [DEPEND] Dependency failed for Local File Systems. [ OK ] Reached target Remote File Systems (Pre). [ OK ] Reached target Remote File Systems. Starting udev Coldplug all Devices... Starting Create Volatile Files and Directories... Starting Kdump Emergency... This patch can bypass it. The fix of root cause is still WIP, but this patch itself is a nice to have optimization so it's reasonable to do so. Signed-off-by: Kairui Song <kasong@redhat.com> Acked-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
367ca85d1f
commit
6dee286467
@ -96,16 +96,31 @@ get_kdump_confs()
|
||||
# dump_fs <mount point| device>
|
||||
dump_fs()
|
||||
{
|
||||
|
||||
local _do_umount=""
|
||||
local _dev=$(findmnt -k -f -n -r -o SOURCE $1)
|
||||
local _mp=$(findmnt -k -f -n -r -o TARGET $1)
|
||||
local _op=$(findmnt -k -f -n -r -o OPTIONS $1)
|
||||
|
||||
echo "kdump: dump target is $_dev"
|
||||
|
||||
if [ -z "$_mp" ]; then
|
||||
echo "kdump: error: Dump target $_dev is not mounted."
|
||||
return 1
|
||||
_dev=$(findmnt -s -f -n -r -o SOURCE $1)
|
||||
_mp=$(findmnt -s -f -n -r -o TARGET $1)
|
||||
_op=$(findmnt -s -f -n -r -o OPTIONS $1)
|
||||
|
||||
if [ -n "$_dev" ] && [ -n "$_mp" ]; then
|
||||
echo "kdump: dump target $_dev is not mounted, trying to mount..."
|
||||
mkdir -p $_mp
|
||||
mount -o $_op $_dev $_mp
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "kdump: mounting failed (mount point: $_mp, option: $_op)"
|
||||
return 1
|
||||
fi
|
||||
_do_umount=1
|
||||
else
|
||||
echo "kdump: error: Dump target $_dev is not usable"
|
||||
fi
|
||||
else
|
||||
echo "kdump: dump target is $_dev"
|
||||
fi
|
||||
|
||||
# Remove -F in makedumpfile case. We don't want a flat format dump here.
|
||||
@ -129,6 +144,11 @@ dump_fs()
|
||||
sync
|
||||
|
||||
echo "kdump: saving vmcore complete"
|
||||
|
||||
if [ $_do_umount ]; then
|
||||
umount $_mp || echo "kdump: warn: failed to umount target"
|
||||
fi
|
||||
|
||||
# improper kernel cmdline can cause the failure of echo, we can ignore this kind of failure
|
||||
return 0
|
||||
}
|
||||
|
5
mkdumprd
5
mkdumprd
@ -108,12 +108,13 @@ to_mount() {
|
||||
fi
|
||||
# mount fs target as rw in 2nd kernel
|
||||
_options=$(echo $_options | sed 's/\(^\|,\)ro\($\|,\)/\1rw\2/g')
|
||||
# with 'noauto' in fstab nfs and non-root disk mount will fail in 2nd
|
||||
# kernel, filter it out here.
|
||||
# filter out 'noauto' here, it will be force appended later, avoid duplication
|
||||
_options=$(echo $_options | sed 's/\(^\|,\)noauto\($\|,\)/\1/g')
|
||||
# drop nofail or nobootwait
|
||||
_options=$(echo $_options | sed 's/\(^\|,\)nofail\($\|,\)/\1/g')
|
||||
_options=$(echo $_options | sed 's/\(^\|,\)nobootwait\($\|,\)/\1/g')
|
||||
# only mount the dump target when needed.
|
||||
_options="$_options,noauto"
|
||||
|
||||
_mntopts="$_target $_fstype $_options"
|
||||
#for non-nfs _dev converting to use udev persistent name
|
||||
|
Loading…
Reference in New Issue
Block a user