From 066b5adf6d737a5bd174123d4d00dab4b6110cf6 Mon Sep 17 00:00:00 2001 From: Sujin Kang Date: Tue, 26 Oct 2021 08:40:13 -0700 Subject: [PATCH] Remove exec from platform_reboot call to prevent reboot hang (#1881) Port fix from master to stop pmon service for reboot and soft-reboot What I did Remove exec from the platform_reboot call to handle any hang issue during reboot Port missing fix from master : stop pmon service for reboot and soft-reboot How I did it Remove "exec" from " exec ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} $@" How to verify it Perform sudo reboot after DE initializing the platfom driver and see if the device gracefully reboots by /sbin/reboot after failing on platform_reboot. --- scripts/reboot | 14 +++++++++++++- scripts/soft-reboot | 12 ++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/reboot b/scripts/reboot index 404bb187bc..4e48ba04c8 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -22,6 +22,17 @@ function debug() logger "$@" } +function stop_pmon_service() +{ + CONTAINER_STOP_RC=0 + debug "Stopping pmon docker" + docker kill pmon &> /dev/null || CONTAINER_STOP_RC=$? + systemctl stop pmon || debug "Ignore stopping pmon error $?" + if [[ CONTAINER_STOP_RC -ne 0 ]]; then + debug "Failed killing container pmon RC $CONTAINER_STOP_RC ." + fi +} + function stop_sonic_services() { if [[ x"$ASIC_TYPE" != x"mellanox" ]]; then @@ -29,6 +40,7 @@ function stop_sonic_services() docker exec -i syncd /usr/bin/syncd_request_shutdown --cold > /dev/null sleep 3 fi + stop_pmon_service } function clear_warm_boot() @@ -141,7 +153,7 @@ fi if [ -x ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} ]; then VERBOSE=yes debug "Rebooting with platform ${PLATFORM} specific tool ..." - exec ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} $@ + ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} $@ # There are a couple reasons execution reaches here: # diff --git a/scripts/soft-reboot b/scripts/soft-reboot index 3c7c9b6261..5c70e3a1ae 100755 --- a/scripts/soft-reboot +++ b/scripts/soft-reboot @@ -27,6 +27,17 @@ function debug() logger "$@" } +function stop_pmon_service() +{ + CONTAINER_STOP_RC=0 + debug "Stopping pmon docker" + docker kill pmon &> /dev/null || CONTAINER_STOP_RC=$? + systemctl stop pmon || debug "Ignore stopping pmon error $?" + if [[ CONTAINER_STOP_RC -ne 0 ]]; then + debug "Failed killing container pmon RC $CONTAINER_STOP_RC ." + fi +} + function stop_sonic_services() { if [[ x"$ASIC_TYPE" != x"mellanox" ]]; then @@ -34,6 +45,7 @@ function stop_sonic_services() docker exec -i syncd /usr/bin/syncd_request_shutdown --cold > /dev/null sleep 3 fi + stop_pmon_service } function clear_lingering_reboot_config()