Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Update
kdump.5722
kdump-udev-reload-only-once.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kdump-udev-reload-only-once.patch of Package kdump.5722
From: Petr Tesarik <ptesarik@suse.com> Date: Fri Sep 4 10:16:25 2015 +0200 Subject: Reload kdump only once if multiple udev events happen in parallel References: bsc#934581 Patch-mainline: v0.8.16 Git-commit: 6859c6c7e8abd0f141ab4709d68d5e50800de80a The kexec(2) system call is not re-entrant, so kdump reload may fail if another reload is already in progress. Solve this by serializing the requests using a lock file under /var/run. Note that it is sufficient to re-run kexec(1) once after all memory configuration changes are finished. To avoid unnecessary runs, the following logic is implemented: If a reload is already in progress, all subsequent reloads exit immediately, letting the running instance redo the job. A jobs file is used to tell the running instance that there are more changes after the first one, so it must reload the kdump kernel one more time. Signed-off-by: Petr Tesarik <ptesarik@suse.com> --- 70-kdump.rules.in | 2 +- init/CMakeLists.txt | 1 + init/load-once.sh | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) --- a/init/CMakeLists.txt +++ b/init/CMakeLists.txt @@ -78,6 +78,7 @@ INSTALL( ${CMAKE_CURRENT_SOURCE_DIR}/setup-kdump.functions ${CMAKE_CURRENT_SOURCE_DIR}/save_dump.sh ${CMAKE_CURRENT_SOURCE_DIR}/load.sh + ${CMAKE_CURRENT_SOURCE_DIR}/load-once.sh ${CMAKE_CURRENT_SOURCE_DIR}/unload.sh DESTINATION /lib/kdump --- /dev/null +++ b/init/load-once.sh @@ -0,0 +1,23 @@ +#! /bin/bash + +# This script ensures that kdump is (re-)loaded once. +# It prevents multiple invocation of load.sh even if multiple instances +# of the script are run in parallel. The first instance repeats the action +# as long as there is any pending work. + +LOCKFILE=/var/run/kdump.lock +JOBSFILE=/var/run/kdump.jobs +export JOBSFILE + +# Add a pending job +echo $$ >> "$JOBSFILE" + +# Make sure lock-file exists +> "$LOCKFILE" + +flock -n "$LOCKFILE" -c ' + while [ -s "$JOBSFILE" ] + do + truncate -s 0 "$JOBSFILE" || exit 1 + /lib/kdump/load.sh + done' --- a/70-kdump.rules.in +++ b/70-kdump.rules.in @@ -20,7 +20,7 @@ GOTO="kdump_end" # Reload only if panic kernel is already loaded LABEL="kdump_try_restart" -PROGRAM="/bin/cat /sys/kernel/kexec_crash_loaded", RESULT!="0", RUN+="/lib/kdump/load.sh" +PROGRAM="/bin/cat /sys/kernel/kexec_crash_loaded", RESULT!="0", RUN+="/lib/kdump/load-once.sh" LABEL="kdump_end" @endif
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor