There will be a race condition if multiple kdumpctl instances are
running at the same time.
By introducing a global mutex lock, only one instance can acquire this
lock and run, others will be waiting for the lock in queue. Now each
kdump instance will be run in serial order and there won't any race
condition.
This is a patch backported from RHEL6.
Signed-off-by: WANG Chao <chaowang(a)redhat.com>
---
kdumpctl | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index aba1e3c..d62b4b4 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -16,6 +16,12 @@ if [ -f /etc/sysconfig/kdump ]; then
. /etc/sysconfig/kdump
fi
+single_instance_lock()
+{
+ exec 9>/var/lock/kdump
+ flock 9
+}
+
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ...
[<paramN>]
# Remove a list of kernel parameters from a given kernel cmdline and print the result.
# For each "arg" in the removing params list, "arg" and
"arg=xxx" will be removed if exists.
@@ -531,6 +537,9 @@ if [ ! -f "$KDUMP_CONFIG_FILE" ]; then
exit 1
fi
+# Other kdumpctl instances will block in queue, until this one exits
+single_instance_lock
+
case "$1" in
start)
if [ -s /proc/vmcore ]; then
--
1.8.3.1
_______________________________________________
kexec mailing list
kexec(a)lists.fedoraproject.org
https://lists.fedoraproject.org/mailman/listinfo/kexec