On Tue, Jul 29, 2014 at 08:52:15PM +0800, WANG Chao wrote:
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
Vivek
kdump-lib-initramfs.sh | 8 +------- mkdumprd | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index d16bcf4..9118b64 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -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; doismounted $mount && umount -R $mountdone- fi
- umount -Rf $NEWROOT
}
do_default_action() diff --git a/mkdumprd b/mkdumprd index b49b74f..ba35800 100644 --- a/mkdumprd +++ b/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
- _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"
- local _dev=$1 _source _target _fstype _options _mntopts _pdev
- _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-- 1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec