Page MenuHomeFreeBSD

/etc/rc: optionally turn on new 'rcorder -p' option to run rc scripts in parallel.
Needs ReviewPublic

Authored by unitrunker_gmail.com on Sep 20 2020, 12:57 AM.

Details

Reviewers
ae
melifaro
avg
julian
0mp
Group Reviewers
rc
Summary

Patch to /etc/rc to optionally turn on the new 'rcorder -p' option to run rc scripts in parallel.

See: https://reviews.freebsd.org/D25389

/etc/rc currently does not support output from 'rcorder -p'.

Make parallel startup optional by an entry in /etc/rc.conf:

rc_parallel_start="YES"

This name mirrors the current, existing variable "jail_parallel_start" that allows jails to start up in parallel. See rc.conf(5).

Test Plan

"AC" - Acceptance Criteria

AC 1:

rc_parallel_start="YES" causes /etc/rc to pass '-p' option to rcorder in the early and late passes. An rc_parallel_start that is undefined, "NO" or any value other than "YES", "TRUE", "ON", or "1" (using checkyesno) will cause /etc/rc to omit the '-p' option to rcorder.

Tested by booting with the "new" rcorder installed in /sbin/ and booting - with and without 'rc_parallel_start=YES' in /etc/rc.conf.
Tested by enabling 'info' messages (sysrc rc_info=YES) and adding 'info ${_rc_parallel}' to the /etc/rc script.

AC 2:

If rcorder returns multiple script paths per line separated by a space, /etc/rc will execute each script - with each script path passed to run_rc_script - as a background task. This behavior is independent of the rc_parallel_start option.

Tested by booting with the "new" rcorder installed in /sbin/ and booting - with and without 'rc_parallel_start=YES' in /etc/rc.conf.
Tested by enabling 'info' messages (sysrc rc_info=YES) and adding 'info ${_rc_group}' and 'info ${_rc_elem}' to the /etc/rc script.

AC 3:

After processing each line of output from rcorder, /etc/rc will pause by calling 'wait' to allow all rc script tasks to complete before proceeding to the next line of output from rcorder. This behavior is independent of the rc_parallel_start option.

Tested by booting with the "new" rcorder installed in /sbin/ and booting - with and without 'rc_parallel_start=YES' in /etc/rc.conf.
Tested by enabling 'info' messages (sysrc rc_info=YES) and adding 'info ${_rc_group}' and 'info ${_rc_elem}' to the /etc/rc script.

AC 4:

In the presence of the "old" rcorder (-p not supported), this /etc/rc script still functions correctly but without parallel execution.

Tested by booting with the "old" rcorder installed in /sbin/ and booting - with and without 'rc_parallel_start=YES' in /etc/rc.conf.

All 'info' statements have been removed from the patch.

Note: in the future, parallel start-up may become the default. This does not eliminate the need for the rc_parallel_start variable. Supporting rc_parallel_start="NO" in /etc/rc.conf remains useful for debugging rc scripts.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped