Address CPU/memory hot plugging for kdump LUKS support

Resolves: https://issues.redhat.com/browse/RHEL-104940
Conflict: None

commit 9de617170ad9bac97db53a2bf031e895fb482dba
Author: Coiby Xu <coxu@redhat.com>
Date:   Wed Jun 25 11:26:53 2025 +0800

    Address CPU/memory hot plugging for kdump LUKS support

    We can reuse LUKS volume keys when there is CPU/memory hot plugging by
    writing 1 to /sys/kernel/config/crash_dm_crypt_keys/resue to reuse keys
    already saved to kdump reserved memory.

    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2025-10-09 16:51:36 +08:00
parent f1ee3f6e22
commit b034968220
2 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,17 @@
throttle_lock="/var/lock/kdump-udev-throttle"
LUKS_CONFIGFS_REUSE=/sys/kernel/config/crash_dm_crypt_keys/reuse
reuse_luks_keys()
{
[[ -f $LUKS_CONFIGFS_REUSE ]] || echo 1 > $LUKS_CONFIGFS_REUSE
}
unuse_luks_keys()
{
[[ -f $LUKS_CONFIGFS_REUSE ]] || echo 0 > $LUKS_CONFIGFS_REUSE
}
exec 9> $throttle_lock
if [ $? -ne 0 ]; then
echo "Failed to create the lock file! Fallback to non-throttled kdump service restart"
@ -37,6 +48,8 @@ sleep 1 && udevadm settle --timeout 3
# holding two locks at the same time and we might miss some events
exec 9>&-
reuse_luks_keys
/bin/kdumpctl reload
unuse_luks_keys
exit 0

View File

@ -1106,6 +1106,9 @@ prepare_luks()
return 1
fi
# For the case of CPU/memory hotplugging, we can reuse loaded keys
[[ $(cat $LUKS_CONFIGFS/reuse) == 1 ]] && return 0
for _luks_dev in "${_luks_devs[@]}"; do
_devuuid=$(maj_min_to_uuid "$_luks_dev")
_key_dir=$LUKS_CONFIGFS/$_devuuid