From nobody Mon Oct 28 21:11:50 2024 X-Original-To: dev-commits-src-all@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 4XcmKf4GmYz5bnYm; Mon, 28 Oct 2024 21:11:50 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XcmKf3q09z4Hl4; Mon, 28 Oct 2024 21:11:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730149910; 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=clFxivi9MDbb9wJLI0nFXJsGpJZsyGVvOKOqKo/rytE=; b=KX5vVJXmxMzR1kOgNYQvasj41onbQ4YcR02E7QTvpm9XTSh7ayv9VbbMwpQ4dlLoDpEGxP qxzSzIcoRiuR802cJu22TTAL4volPoONf783fI2vXa8xZxG5wazfY6J+eBkJzIIwBViNnM anwpjQM9ilHh/Y4+NZ7Uojba0UEMlsDeonro8rjG49yKe4P8BvZB88+/P8LjHLIvOtJQl5 KSX57kIDjvdnn9tA8RjEH3yntYqrkYkWo13lCchUw2+iE7BxULCNmsJCnn+hapWiRVIC9D 5C/5OR8Zfkaoqyrv2t+9MtBrhkxOpr24KPtCKMr9WEBx2uUCagc/P4WasOQPqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730149910; 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=clFxivi9MDbb9wJLI0nFXJsGpJZsyGVvOKOqKo/rytE=; b=aSZcpKs4zZjbdP8bAjGxLP2JM03bhmNcWrb18I5C1ZgcbNoGAU4Rj+G19GCMv1SxfojxQe MCJlgyF9a3bN4VbVX3sQ99Bb4XTonF25mbkrhIAA1GiRbZXn3Ywg/ZrBYN5lVt2HxaUoL6 7qZ+/G1kUhQSESJDW9MG68flyETk1f+O5yqWCiO0tYxwPqlDGXDz2LT4polheJw1aWNZ0n UctwxobuVRe0soBW0blYQ3NpSRpy0TLMF9Dm0iyHAExpX9bD2sFhzFGemVUOgFRdoPHZfw xg0EB/J2qM+9GWLhtGq741xfPGujNvoRcDz5xZNTpbcNygCp05/3zq+gYVtmcg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730149910; a=rsa-sha256; cv=none; b=bO6roJZaIbnKKZScQfSSR/JZeBf1in2IoTwrtlq1vCq4Da0KbJFrTV2trmJ7NfMkTGKkqV JemIJBqEjX4abBy254+sJDEeGqdDWI12o8elXGjBIEgOnpnL1LtN1w8hPHmjMC3oOyp6mJ n1XIp1jTSnDQPvW052R9IGbnNnnJk0fq6sQ+9ywAtkgXsGzMZZ2svQ4F0CE6+jKrqkFhsl Z3Z8ejUeGzJHomSVCxRJKMWBZXuKiJrg4NhPh8Dj5teVCff8w8R+ZqT2oTn7mc5b+68VXe pXawa6fhJl7fD3BkllSE0QQVM/6tM+CK2vd7DDlvg00lxB8Gk+X+sukFdGONlA== 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 4XcmKf3QgGzvjx; Mon, 28 Oct 2024 21:11:50 +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 49SLBoXH019793; Mon, 28 Oct 2024 21:11:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49SLBo5V019790; Mon, 28 Oct 2024 21:11:50 GMT (envelope-from git) Date: Mon, 28 Oct 2024 21:11:50 GMT Message-Id: <202410282111.49SLBo5V019790@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Piotrowski <0mp@FreeBSD.org> Subject: git: a5ad360ff9b7 - main - rc: Remove rc_fast_and_loose List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: 0mp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a5ad360ff9b7fb2ef3f7f31b8c29c332026b0e01 Auto-Submitted: auto-generated The branch main has been updated by 0mp: URL: https://cgit.FreeBSD.org/src/commit/?id=a5ad360ff9b7fb2ef3f7f31b8c29c332026b0e01 commit a5ad360ff9b7fb2ef3f7f31b8c29c332026b0e01 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2024-10-23 12:57:29 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2024-10-28 21:10:49 +0000 rc: Remove rc_fast_and_loose The rc_fast_and_loose variable allowed rc(8) to start services by sourcing them into rc's own shell environment. Normally, each rc service script is started by being sourced into its own subshell instead. The feature was meant to speed up rc(8) by avoiding the extra forking necessary to spawn subshells. In practice, the feature has been broken for a long time now. One of the reasons is that some rc service scripts call the exit builtin to return non-zero error codes, which not only terminates the service subshell but also rc(8) when rc_fast_and_loose is enabled. For example, a system running any of the supported FreeBSD releases with rc_fast_and_loose=yes would abort rc(8) as early as rc.d/hostid, due to an "exit 0". Fixing rc_fast_and_loose support would require rewriting some rc scripts to support being sourced directly into rc(8) process. This would muddy the code base and also would prove difficult to maintain long term as this is simply not how rc(8) users write scripts. The potential performance benefits are unlikely to be significant even for use cases such as Morello under qemu. Instead, remove support for rc_fast_and_loose completely from rc(8) and inform users about the change. PR: 282255 Reviewed by: brooks, christos, mhorne Approved by: christos (mentor), markj (mentor) MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D47264 --- UPDATING | 7 +++++++ libexec/rc/rc.subr | 20 ++------------------ share/man/man8/rc.subr.8 | 36 +++++++++++------------------------- 3 files changed, 20 insertions(+), 43 deletions(-) diff --git a/UPDATING b/UPDATING index c2e7a658c65e..1fb14a96880b 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20241025: + The support for the rc_fast_and_loose variable has been removed from + rc.subr(8). Users setting rc_fast_and_loose on their systems are + advised to make sure their customizations to rc service scripts + do not depend on having a single shell environment shared across + all the rc service scripts during booting and shutdown. + 20241013: The ciss driver was updated to cope better with hotplug events that caused it to panic before, and to support more than 48 drives attached diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index 58e30c897897..dc2cc06bb806 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -1798,9 +1798,6 @@ _run_rc_killcmd() # return value from the script. # If `file' ends with `.sh' and lives in /etc/rc.d, ignore it as it's # an old-style startup file. -# If `file' ends with `.sh' and does not live in /etc/rc.d, it's sourced -# into the current environment if $rc_fast_and_loose is set; otherwise -# it is run as a child process. # If `file' appears to be a backup or scratch file, ignore it. # Otherwise if it is executable run as a child process. # @@ -1836,8 +1833,6 @@ run_rc_script() if [ -n "$rc_boottrace" ]; then boottrace_fn "$_file" "$_arg" - elif [ -n "$rc_fast_and_loose" ]; then - set $_arg; . $_file else ( trap "echo Script $_file interrupted >&2 ; kill -QUIT $$" 3 trap "echo Script $_file interrupted >&2 ; exit 1" 2 @@ -1909,19 +1904,8 @@ boottrace_fn() _file=$1 _arg=$2 - if [ -n "$rc_fast_and_loose" ]; then - boottrace_sysctl "$_file start" - set $_arg; . $_file - boottrace_sysctl "$_file done" - else - _boot="${_boot}" rc_fast="${rc_fast}" autoboot="${autoboot}" \ - $boottrace_cmd "$_file" "$_arg" - fi -} - -boottrace_sysctl() -{ - ${SYSCTL} kern.boottrace.boottrace="$1" + _boot="${_boot}" rc_fast="${rc_fast}" autoboot="${autoboot}" \ + $boottrace_cmd "$_file" "$_arg" } # diff --git a/share/man/man8/rc.subr.8 b/share/man/man8/rc.subr.8 index 36d7d4543e52..1fd5041cecd8 100644 --- a/share/man/man8/rc.subr.8 +++ b/share/man/man8/rc.subr.8 @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd September 22, 2024 +.Dd October 23, 2024 .Dt RC.SUBR 8 .Os .Sh NAME @@ -1017,41 +1017,27 @@ and to enable tracing if any of those tags appear in .Va DEBUG_SH . .Pp -The startup behaviour of +.Ic run_rc_script +executes .Ar file -depends upon the following checks: +unless: .Bl -enum .It -If .Ar file ends in -.Pa .sh , -it is sourced into the current shell. +.Pa .sh +and lives in +.Pa /etc/rc.d . .It -If .Ar file appears to be a backup or scratch file -(e.g., with a suffix of -.Pa ~ , # , .OLD , +.Po e.g., with a suffix of +.Pa ~ , # , .OLD , ,v , or -.Pa .orig ) , -ignore it. +.Pa .orig Pc . .It -If .Ar file -is not executable, ignore it. -.It -If the -.Xr rc.conf 5 -variable -.Va rc_fast_and_loose -is empty, -source -.Ar file -in a sub shell, -otherwise source -.Ar file -into the current shell. +is not executable. .El .It Ic run_rc_scripts Oo options Oc file ... Call