From 41f1d5b2e98b5ecdc1412094d534928ef277b516 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: May 14 2021 06:27:03 +0000 Subject: fadump: fix dump capture failure to root disk Resolves: bz1952652 Upstream: fedora Conflict: none commit d0e9c51e0de57273a99af8484515f213b8414e65 Author: Hari Bathini Date: Thu Apr 22 18:21:59 2021 +0530 fadump: fix dump capture failure to root disk If the dump target is the root disk, kdump scripts add an entry in /etc/fstab for root disk with /sysroot as the mount point. The root disk, passed through root=<> kernel commandline parameter, is mounted at /sysroot in read-only mode before switching from initial ramdisk. So, in fadump mode, a remount of /sysroot to read-write mode is needed to capture dump successfully, because /sysroot is already mounted as read-only based on root=<> boot parameter. Commit e8ef4db8ff91 ("Fix dump_fs mount point detection and fallback mount") removed initialization of $_op variable, the variable holding the options the dump target was mounted with, leading to the below error as remount was skipped: kdump[586]: saving to /sysroot/var/crash/127.0.0.1-2021-04-22-07:22:08/ kdump.sh[587]: mkdir: cannot create directory '/sysroot/var/crash/127.0.0.1-2021-04-22-07:22:08/': Read-only file system kdump[589]: saving vmcore failed Restore $_op variable initialization in dump_fs() function to fix this. Fixes: e8ef4db8ff91 ("Fix dump_fs mount point detection and fallback mount") Signed-off-by: Hari Bathini Acked-by: Kairui Song Signed-off-by: Tao Liu --- diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 341aa00..d0d124f 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -119,7 +119,8 @@ dump_fs() { local _exitcode local _mp=$1 - ddebug "dump_fs _mp=$_mp" + local _op=$(get_mount_info OPTIONS target $_mp -f) + ddebug "dump_fs _mp=$_mp _opts=$_op" if ! is_mounted "$_mp"; then dinfo "dump path \"$_mp\" is not mounted, trying to mount..." @@ -139,8 +140,8 @@ dump_fs() # Only remount to read-write mode if the dump target is mounted read-only. if [[ "$_op" = "ro"* ]]; then - dinfo "Mounting Dump target $_dev in rw mode." - mount -o remount,rw $_dev $_mp || return 1 + dinfo "Remounting the dump target in rw mode." + mount -o remount,rw $_mp || return 1 fi mkdir -p $_dump_path || return 1