Only acquire the single instance lock when following commands are used:
- kdumpctl start
- kdumpctl status
- kdumpctl restart
- kdumpctl rebuild
- kdumpctl reload
- kdumpctl stop
- kdumpctl propagate
For other commands, like showmem, estimate or help, there is no reason
for kdumpctl to be blocked.
Signed-off-by: Kairui Song <kasong(a)redhat.com>
---
kdumpctl | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 0d4b7e08..7b1a2c3c 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1342,6 +1342,7 @@ main()
case "$1" in
start)
+ single_instance_lock
if [[ -s /proc/vmcore ]]; then
save_core
reboot
@@ -1350,9 +1351,11 @@ main()
fi
;;
stop)
+ single_instance_lock
stop
;;
status)
+ single_instance_lock
EXIT_CODE=0
check_current_status
case "$?" in
@@ -1368,17 +1371,22 @@ main()
exit $EXIT_CODE
;;
reload)
+ single_instance_lock
reload
;;
restart)
+ single_instance_lock
stop
start
;;
rebuild)
+ single_instance_lock
rebuild
;;
- condrestart) ;;
+ condrestart)
+ ;;
propagate)
+ single_instance_lock
propagate_ssh_key
;;
showmem)
@@ -1397,9 +1405,6 @@ main()
esac
}
-# Other kdumpctl instances will block in queue, until this one exits
-single_instance_lock
-
main "$@"
exit $?
--
2.31.1