Date: Thu, 30 Oct 2025 23:52:26 GMT From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: ac84e695eb4e - releng/15.0 - rc.subr: Fix slow shutdown issue Message-ID: <202510302352.59UNqQsW087134@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch releng/15.0 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=ac84e695eb4ecdd24185649abfd0b692c303d74e commit ac84e695eb4ecdd24185649abfd0b692c303d74e Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2025-10-28 11:57:03 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2025-10-30 23:48:19 +0000 rc.subr: Fix slow shutdown issue Instead of sleeping after pwait returns, use its new -p option to obtain the list of processes that still have not terminated. Approved by: re (cperciva) MFC after: 3 days PR: 290357 Fixes: 5953e7c98427 ("rc.subr: Move the sleep in wait_for_pids") Reviewed by: 0mp, markj Differential Revision: https://reviews.freebsd.org/D53294 (cherry picked from commit 22cff1f3e9d82b48aad440c52f883bfd4995359c) (cherry picked from commit 7b375832c252430243810ca85d6cbf67820457d5) --- libexec/rc/rc.subr | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index 6be226021949..8317ff5c0922 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -792,31 +792,18 @@ sort_lite() # wait_for_pids() { - local _list _prefix _nlist _j + local _list _prefix _j - _list="$@" - if [ -z "$_list" ]; then - return - fi - _prefix= - while true; do - _nlist="" - for _j in $_list; do - if kill -0 $_j 2>/dev/null; then - _nlist="${_nlist}${_nlist:+ }$_j" - fi - done - if [ -z "$_nlist" ]; then - break + for _j in "$@"; do + if kill -0 $_j 2>/dev/null; then + _list="${_list}${_list:+ }$_j" fi - _list=$_nlist + done + _prefix= + while [ -n "$_list" ]; do echo -n ${_prefix:-"Waiting for PIDS: "}$_list _prefix=", " - pwait -o $_list 2>/dev/null - # At least one of the processes we were waiting for - # has terminated. Give init a chance to collect it - # before looping around and checking again. - sleep 1 + _list=$(pwait -op $_list 2>/dev/null) done if [ -n "$_prefix" ]; then echo "."home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510302352.59UNqQsW087134>
