mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-21 07:15:49 +00:00
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
This commit is contained in:
parent
10c429016a
commit
a5ad360ff9
7
UPDATING
7
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
|
world, or to merely disable the most expensive debugging functionality
|
||||||
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
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:
|
20241013:
|
||||||
The ciss driver was updated to cope better with hotplug events that
|
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
|
caused it to panic before, and to support more than 48 drives attached
|
||||||
|
@ -1798,9 +1798,6 @@ _run_rc_killcmd()
|
|||||||
# return value from the script.
|
# return value from the script.
|
||||||
# If `file' ends with `.sh' and lives in /etc/rc.d, ignore it as it's
|
# If `file' ends with `.sh' and lives in /etc/rc.d, ignore it as it's
|
||||||
# an old-style startup file.
|
# 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.
|
# If `file' appears to be a backup or scratch file, ignore it.
|
||||||
# Otherwise if it is executable run as a child process.
|
# Otherwise if it is executable run as a child process.
|
||||||
#
|
#
|
||||||
@ -1836,8 +1833,6 @@ run_rc_script()
|
|||||||
|
|
||||||
if [ -n "$rc_boottrace" ]; then
|
if [ -n "$rc_boottrace" ]; then
|
||||||
boottrace_fn "$_file" "$_arg"
|
boottrace_fn "$_file" "$_arg"
|
||||||
elif [ -n "$rc_fast_and_loose" ]; then
|
|
||||||
set $_arg; . $_file
|
|
||||||
else
|
else
|
||||||
( trap "echo Script $_file interrupted >&2 ; kill -QUIT $$" 3
|
( trap "echo Script $_file interrupted >&2 ; kill -QUIT $$" 3
|
||||||
trap "echo Script $_file interrupted >&2 ; exit 1" 2
|
trap "echo Script $_file interrupted >&2 ; exit 1" 2
|
||||||
@ -1909,19 +1904,8 @@ boottrace_fn()
|
|||||||
_file=$1
|
_file=$1
|
||||||
_arg=$2
|
_arg=$2
|
||||||
|
|
||||||
if [ -n "$rc_fast_and_loose" ]; then
|
_boot="${_boot}" rc_fast="${rc_fast}" autoboot="${autoboot}" \
|
||||||
boottrace_sysctl "$_file start"
|
$boottrace_cmd "$_file" "$_arg"
|
||||||
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"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd September 22, 2024
|
.Dd October 23, 2024
|
||||||
.Dt RC.SUBR 8
|
.Dt RC.SUBR 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -1017,41 +1017,27 @@ and
|
|||||||
to enable tracing if any of those tags appear in
|
to enable tracing if any of those tags appear in
|
||||||
.Va DEBUG_SH .
|
.Va DEBUG_SH .
|
||||||
.Pp
|
.Pp
|
||||||
The startup behaviour of
|
.Ic run_rc_script
|
||||||
|
executes
|
||||||
.Ar file
|
.Ar file
|
||||||
depends upon the following checks:
|
unless:
|
||||||
.Bl -enum
|
.Bl -enum
|
||||||
.It
|
.It
|
||||||
If
|
|
||||||
.Ar file
|
.Ar file
|
||||||
ends in
|
ends in
|
||||||
.Pa .sh ,
|
.Pa .sh
|
||||||
it is sourced into the current shell.
|
and lives in
|
||||||
|
.Pa /etc/rc.d .
|
||||||
.It
|
.It
|
||||||
If
|
|
||||||
.Ar file
|
.Ar file
|
||||||
appears to be a backup or scratch file
|
appears to be a backup or scratch file
|
||||||
(e.g., with a suffix of
|
.Po e.g., with a suffix of
|
||||||
.Pa ~ , # , .OLD ,
|
.Pa ~ , # , .OLD , ,v ,
|
||||||
or
|
or
|
||||||
.Pa .orig ) ,
|
.Pa .orig Pc .
|
||||||
ignore it.
|
|
||||||
.It
|
.It
|
||||||
If
|
|
||||||
.Ar file
|
.Ar file
|
||||||
is not executable, ignore it.
|
is not executable.
|
||||||
.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.
|
|
||||||
.El
|
.El
|
||||||
.It Ic run_rc_scripts Oo options Oc file ...
|
.It Ic run_rc_scripts Oo options Oc file ...
|
||||||
Call
|
Call
|
||||||
|
Loading…
Reference in New Issue
Block a user