logger: source the logger file individually

Sourcing logger file in kdump-lib.sh will leak kdump helper to dracut,
because module-setup.sh will source kdump-lib.sh. This will make kdump's
function override dracut's ones, and lead to unexpected behaviours.

So include kdump-logger.sh individually and only source it where it really
needed. for module-setup.sh, simply use dracut's logger helper is good
enough so just source kdump-logger.sh in kdump only scripts.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
Kairui Song 2021-01-19 20:10:28 +08:00
parent e8ef4db8ff
commit 02202aa70f
6 changed files with 5 additions and 6 deletions

View File

@ -12,6 +12,7 @@ EARLY_KEXEC_ARGS=""
. /etc/sysconfig/kdump
. /lib/dracut-lib.sh
. /lib/kdump-lib.sh
. /lib/kdump-logger.sh
#initiate the kdump logger
dlog_init

View File

@ -4,6 +4,7 @@
# http://www.freedesktop.org/wiki/Software/systemd/Generators/
. /usr/lib/kdump/kdump-lib.sh
. /usr/lib/kdump/kdump-logger.sh
# If invokded with no arguments for testing purpose, output to /tmp to
# avoid overriding the existing.

View File

@ -1,6 +1,7 @@
# These variables and functions are useful in 2nd kernel
. /lib/kdump-lib.sh
. /lib/kdump-logger.sh
KDUMP_PATH="/var/crash"
KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log"

View File

@ -8,12 +8,6 @@ FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
if [ -f /lib/kdump/kdump-logger.sh ]; then
. /lib/kdump/kdump-logger.sh
elif [ -f /lib/kdump-logger.sh ]; then
. /lib/kdump-logger.sh
fi
is_fadump_capable()
{
# Check if firmware-assisted dump is enabled

View File

@ -34,6 +34,7 @@ fi
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
. $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh
. /lib/kdump/kdump-logger.sh
#initiate the kdump logger
dlog_init

View File

@ -13,6 +13,7 @@ fi
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
. $dracutbasedir/dracut-functions.sh
. /lib/kdump/kdump-lib.sh
. /lib/kdump/kdump-logger.sh
export IN_KDUMP=1
#initiate the kdump logger