cleanup: mount dump target under /sysroot in 2nd kernel
This patch does the following change in 2nd kernel: - dump target is mounted under /sysroot With this change, we don't need to track what we've mounted in 2nd kernel. We can just umount recursively every mount in /sysroot by command: umount -R /sysroot It's very convenient to do so, because it's hard to track what we've mounted when we're in error handling path (later patches). So mount everything under /sysroot is reasonable and practical for us. Also clean up a bit along with this patch. Signed-off-by: WANG Chao <chaowang@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
parent
3b27570bea
commit
0787accc4e
@ -19,7 +19,6 @@ KDUMP_CONF="/etc/kdump.conf"
|
||||
KDUMP_PRE=""
|
||||
KDUMP_POST=""
|
||||
NEWROOT="/sysroot"
|
||||
MOUNTS=""
|
||||
|
||||
get_kdump_confs()
|
||||
{
|
||||
@ -89,7 +88,6 @@ dump_fs()
|
||||
echo "kdump: error: Dump target $_dev is not mounted."
|
||||
return 1
|
||||
fi
|
||||
MOUNTS="$MOUNTS $_mp"
|
||||
|
||||
# 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"`
|
||||
@ -131,11 +129,7 @@ save_vmcore_dmesg_fs() {
|
||||
|
||||
do_umount()
|
||||
{
|
||||
if [ -n "$MOUNTS" ]; then
|
||||
for mount in $MOUNTS; do
|
||||
ismounted $mount && umount -R $mount
|
||||
done
|
||||
fi
|
||||
umount -Rf $NEWROOT
|
||||
}
|
||||
|
||||
do_default_action()
|
||||
|
22
mkdumprd
22
mkdumprd
@ -97,19 +97,19 @@ target_is_root() {
|
||||
|
||||
# caller should ensure $1 is valid and mounted in 1st kernel
|
||||
to_mount() {
|
||||
local _dev=$1 _s _t _o _mntopts _pdev
|
||||
local _dev=$1 _source _target _fstype _options _mntopts _pdev
|
||||
|
||||
_s=$(findmnt -k -f -n -r -o SOURCE $_dev)
|
||||
_t=$(findmnt -k -f -n -r -o TARGET,FSTYPE $_dev)
|
||||
_o=$(findmnt -k -f -n -r -o OPTIONS $_dev)
|
||||
_o=${_o/#ro/rw} #mount fs target as rw in 2nd kernel
|
||||
# "nofail" mount could be run later than kdump.sh. So we don't pass nofail
|
||||
# for short term.
|
||||
#_o="${_o},nofail" #with nofail set, systemd won't block for mount failure
|
||||
_mntopts="$_t $_o"
|
||||
_source=$(findmnt -k -f -n -r -o SOURCE $_dev)
|
||||
_target=$(findmnt -k -f -n -r -o TARGET $_dev)
|
||||
# mount under /sysroot in 2nd kernel, and we umount -R /sysroot before exit
|
||||
_target="/sysroot$_target"
|
||||
_fstype=$(findmnt -k -f -n -r -o FSTYPE $_dev)
|
||||
_options=$(findmnt -k -f -n -r -o OPTIONS $_dev)
|
||||
_options=${_options/#ro/rw} #mount fs target as rw in 2nd kernel
|
||||
_mntopts="$_target $_fstype $_options"
|
||||
#for non-nfs _dev converting to use udev persistent name
|
||||
if [ -b "$_s" ]; then
|
||||
_pdev="$(get_persistent_dev $_s)"
|
||||
if [ -b "$_source" ]; then
|
||||
_pdev="$(get_persistent_dev $_source)"
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user