kdumpctl: display message while waiting for the single instance lock

Vivek suggested we should display message while waiting for the lock,
because the waiting could be long and user will have no idea what's
going on.

So we will repeat the following message every 5 seconds while waiting:

"Another app is currently holding the kdump lock; waiting for it to exit..."

Thanks Vivek for providing a more comprehensive message.

Signed-off-by: WANG Chao <chaowang@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
WANG Chao 2014-07-16 20:09:48 +08:00
parent 993961a411
commit 463742ad95

View File

@ -20,8 +20,18 @@ fi
single_instance_lock() single_instance_lock()
{ {
local rc timeout=5
exec 9>/var/lock/kdump exec 9>/var/lock/kdump
flock 9
flock -n 9
rc=$?
while [ $rc -ne 0 ]; do
echo "Another app is currently holding the kdump lock; waiting for it to exit..."
flock -w $timeout 9
rc=$?
done
} }
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>] # remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]