Looks good to me, thanks!
Acked-by: Kairui Song <kasong(a)redhat.com>
On Tue, Dec 4, 2018 at 11:09 AM Pingfan Liu <piliu(a)redhat.com> wrote:
If default action is poweroff, we can observe that the machine is rebooted,
instead of poweroff. That is due to the following two race processes:
systemctl poweroff
systemctl reboot -f
which is launched by kdump-error-handle.sh.
Unfortunately, although both of them are executed in systemd block mode,
but due to poweroff will tear down some internal things in systemd, there
is no guarantee for the block mode. As we can see the msg "Failed to execute
operation: Connection reset by peer", which is thrown by "systemctl reboot
-f"
poweroff and reboot share most of code, if one fails, then the other should
also fails, so it is meaningless to use reboot as the backup of poweroff.
Using "systemctl poweroff -f", the sdbus will teared down immediately,
which prevent the following "systemctl reboot -f" from executing. Meanwhile,
as man systemctl says:
-f, --force
When used with enable, overwrite any existing conflicting symlinks.
When used with halt, poweroff, reboot or kexec, execute the selected operation
without shutting down all units. However, all processes will be killed
forcibly and all file systems are unmounted or remounted read-only.
Hence, replacing the 'poweroff' with 'systemctl poweroff -f'
Signed-off-by: Pingfan Liu <piliu(a)redhat.com>
---
kdump-lib-initramfs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index c7f874f..f5155a4 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -63,7 +63,7 @@ get_kdump_confs()
DEFAULT_ACTION="halt"
;;
poweroff)
- DEFAULT_ACTION="poweroff"
+ DEFAULT_ACTION="systemctl poweroff -f"
;;
dump_to_rootfs)
DEFAULT_ACTION="dump_to_rootfs"
--
2.7.4
--
Best Regards,
Kairui Song