kdumpctl: Run multiple kdumpctl instances one by one in serial order
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@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
parent
2ce047b9ed
commit
a6f03150e9
9
kdumpctl
9
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
|
||||
|
Loading…
Reference in New Issue
Block a user