diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2017-07-13 00:19:32 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2017-07-20 21:41:33 +0200 |
commit | 1ab227d68852c1cb869926057774540bded24d41 (patch) | |
tree | 1aa0154369acf1786c8bb987ea7b8412ed49dfd5 | |
parent | ae30673b100757ee4367ec40e9902f7f3ddd8269 (diff) | |
download | upstream-1ab227d68852c1cb869926057774540bded24d41.tar.gz upstream-1ab227d68852c1cb869926057774540bded24d41.tar.bz2 upstream-1ab227d68852c1cb869926057774540bded24d41.zip |
base-files: upgrade: don't loop forever trying to kill processes
When processes don't die on SIGKILL (usually because of kernel bugs), it's
better to give up instead of looping forever.
upgraded will trigger a reboot in this case (and if this fails, a hardware
watchdog will eventually time out and reset the system, if present).
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
-rwxr-xr-x | package/base-files/files/lib/upgrade/stage2 | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/package/base-files/files/lib/upgrade/stage2 b/package/base-files/files/lib/upgrade/stage2 index 5a439f1201..d7f92a4f35 100755 --- a/package/base-files/files/lib/upgrade/stage2 +++ b/package/base-files/files/lib/upgrade/stage2 @@ -78,6 +78,8 @@ switch_to_ramfs() { } kill_remaining() { # [ <signal> [ <loop> ] ] + local loop_limit=10 + local sig="${1:-TERM}" local loop="${2:-0}" local run=true @@ -108,8 +110,15 @@ kill_remaining() { # [ <signal> [ <loop> ] ] [ $loop -eq 1 ] && run=true done + + let loop_limit-- + [ $loop_limit -eq 0 ] && { + echo + echo "Failed to kill all processes." + exit 1 + } done - echo "" + echo } |