Skip to content

Commit d0203f9

Browse files
committed
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 <[email protected]>
1 parent 0433e1b commit d0203f9

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

kdump-udev-throttler

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515

1616
throttle_lock="/var/lock/kdump-udev-throttle"
1717

18+
LUKS_CONFIGFS_REUSE=/sys/kernel/config/crash_dm_crypt_keys/reuse
19+
reuse_luks_keys()
20+
{
21+
[[ -f $LUKS_CONFIGFS_REUSE ]] || echo 1 > $LUKS_CONFIGFS_REUSE
22+
}
23+
24+
unuse_luks_keys()
25+
{
26+
27+
[[ -f $LUKS_CONFIGFS_REUSE ]] || echo 0 > $LUKS_CONFIGFS_REUSE
28+
}
1829
exec 9> $throttle_lock
1930
if [ $? -ne 0 ]; then
2031
echo "Failed to create the lock file! Fallback to non-throttled kdump service restart"
@@ -37,6 +48,8 @@ sleep 1 && udevadm settle --timeout 3
3748
# holding two locks at the same time and we might miss some events
3849
exec 9>&-
3950

51+
reuse_luks_keys
4052
/bin/kdumpctl reload
53+
unuse_luks_keys
4154

4255
exit 0

kdumpctl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,9 @@ prepare_luks()
11051105
return 1
11061106
fi
11071107

1108+
# For the case of CPU/memory hotplugging, we can reuse loaded keys
1109+
[[ $(cat $LUKS_CONFIGFS/reuse) == 1 ]] && return 0
1110+
11081111
for _luks_dev in "${_luks_devs[@]}"; do
11091112
_devuuid=$(maj_min_to_uuid "$_luks_dev")
11101113
_key_dir=$LUKS_CONFIGFS/$_devuuid

0 commit comments

Comments
 (0)