From nobody Thu Oct 30 10:38:47 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cy0vq64qYz6FShh; Thu, 30 Oct 2025 10:38:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cy0vq49Rgz41DV; Thu, 30 Oct 2025 10:38:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761820727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p/w6WAQ6PKMC6EXeBAqBkr36ZDfj7tAfzkh61JmYo8o=; b=PmVq8kW/WqzHgJzvB5o3ka16HLzbkm83ps3ajCMI+zKgxqrXFJm3puQCxx2n5K/vH8KV+P 01z2FKflbqJB+JXO2XW6evWjnLbRd9TYjCwvrjGBynkvgXbNdgNyOL1QSL4SHVck1pSzsn 1vaevkJioeaLFRgZRshUkgbGgk/j+nBZXgc6ZfEaydJAKM95SrBt7wY33VQF75kY6xJkks qq6yS9Qx0xFZ+V5HFXDQGu/mnsUykgP9S64vpeDEncKPu7jHZhbBFRb0P7Tk7n993AiIqM C8F61QoSzIaKku2afJJ4sft7GYVVhH9zTBg50d+m8XxBQR8EIO5gjLgPvOYnDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761820727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=p/w6WAQ6PKMC6EXeBAqBkr36ZDfj7tAfzkh61JmYo8o=; b=iWOSWwf5EjGmZkemmfRnYizy2Y5gLW6bpFvJo+YTDKIPaS7hgRDu2HsFy/n/BNL6PBIg1F P9Bo/6KhGY4tE9zN5+qBJhhVtPd55BpdK6c5cXQF1yM6ZTIkCzemxsMgceefGOyDLyQStp z+3Nx0csV7ElLygk+ywroNPw2RpF0wmfTMX6hcCzmv4lMoZT6D/X3qlfzG+7TmcEvwhMcF FSrDpz5AP567msO8lzTE4Be3ICVCoAJbs0aU4ZBozi0FZfur8w8vaj3WiEW8LQ+rArT9SI zoxLL3PtgKZy0zXPYku/xpBS31Rd8MdvbEsvsMF+Gvh1IiU1yvcvx1ozmqaiGg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761820727; a=rsa-sha256; cv=none; b=wPrVg6to/VB3VGhpp+MBpal1+38q8D4t5uLO/ksYqTwYB8vFPN/31O83/GLh4iZG6FiJqr ujzA4P7zQDhZKF7ADBTv/FeRALFxkCrnyfucCvtUeTQZTI8WNGQVy5aowzwTA1RD6GFw/3 0+W6y2RkHtZwByW8RSy2qlSCJsWUzep3wk8V+kCfo80R13YySLihxapDmqfMQLb/sZRVHv cOf6yK+ELFirihglgzbMM5EvZQmd/ESWbSQZ7CeCvRU/CIu2DUbV1JMbxeORyoVI6fOZLs bLU8C9MRvXt2LEJZZ228p4sKAS6IMe2T36RQG75wNYxUQujuc2w01z5K+ot7oQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cy0vq3jJYz3tr; Thu, 30 Oct 2025 10:38:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59UAclF7082585; Thu, 30 Oct 2025 10:38:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59UAcljh082583; Thu, 30 Oct 2025 10:38:47 GMT (envelope-from git) Date: Thu, 30 Oct 2025 10:38:47 GMT Message-Id: <202510301038.59UAcljh082583@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: af13a06ab206 - stable/14 - rc.subr: Fix slow shutdown issue List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: af13a06ab206b7009f689bf082ecbc776887ecee Auto-Submitted: auto-generated The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=af13a06ab206b7009f689bf082ecbc776887ecee commit af13a06ab206b7009f689bf082ecbc776887ecee Author: Dag-Erling Smørgrav AuthorDate: 2025-10-28 11:57:03 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-10-30 10:38: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. 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) --- 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 a4f3762afd2c..bef364af0843 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -634,31 +634,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 "."