freebsd-dev/sbin
Andriy Gapon 5fda0d60c1 add ability to set watchdog timeout for a shutdown
This change allows to specify a watchdog(9) timeout for a system
shutdown.  The timeout is activated when the watchdogd daemon is
stopped.  The idea is to a prevent any indefinite hang during late
stages of the shutdown.  The feature is implemented in rc.d/watchdogd,
it builds upon watchdogd -x option.

Note that the shutdown timeout is not actiavted when the watchdogd
service is individually stopped by an operator.  It is also not
activated for the 'shutdown' to the single-user mode.  In those cases it
is assumed that the operator knows what they are doing and they have
means to recover the system should it hang.

Significant subchanges and implementation details:
- the argument to rc.shutdown, completely unused before, is assigned to
  rc_shutdown variable that can be inspected by rc scripts
- init(8) passes "single" or "reboot" as the argument, this is not
  changed
- the argument is not mandatory and if it is not set then rc_shutdown is
  set to "unspecified"
- however, the default jail management scripts and jail configuration
  examples have been updated to pass "jail" to rc.shutdown, just in case
- the new timeout can be set via watchdogd_shutdown_timeout rc option
- for consistency, the regular timeout can now be set via
  watchdogd_timeout rc option
- watchdogd_shutdown_timeout and watchdogd_timeout override timeout
  specifications in watchdogd_flags
- existing configurations, where the new rc options are not set, should
  keep working as before

I am not particularly wed to any of the implementation specifics.
I am open to changing or removing any of them as long as the provided
functionality is the same (or very close) to the proposed one.
For example, I think it can be implemented without using watchdogd -x,
by means of watchdog(1) alone.  In that case there would be a small
window between stopping watchdogd and running watchdog, but I think that
that is acceptable.

Reviewed by:	bcr (man page changes)
MFC after:	5 weeks
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D21221
2019-10-03 11:23:10 +00:00
..
adjkerntz
bectl bectl(8): Add a "check" command 2019-09-11 13:27:10 +00:00
bsdlabel Remove deprecated GEOM classes 2019-08-13 20:06:55 +00:00
camcontrol Remove Tagged Command Queuing feature reporting. 2019-09-12 17:42:37 +00:00
ccdconfig
clri
comcontrol
conscontrol
ddb
decryptcore EKCD: Add Chacha20 encryption mode 2019-05-23 20:12:24 +00:00
devd Stop linking to libl by specifying we do not need yywrap 2019-09-10 08:19:46 +00:00
devfs
devmatch
dhclient Free DHCP options with length zero. 2019-06-26 20:19:48 +00:00
dmesg
dump Clarify that the -r and -R options can be used only to create level 0 dumps. 2019-06-14 06:10:15 +00:00
dumpfs
dumpon EKCD: Add Chacha20 encryption mode 2019-05-23 20:12:24 +00:00
etherswitchcfg Add the 'drop tagged' flag support for ethernet switch ports. 2019-06-28 22:12:43 +00:00
fdisk Remove deprecated GEOM classes 2019-08-13 20:06:55 +00:00
ffsinfo
fsck
fsck_ffs Correct the location of the first backup superblock in fsck_ffs.8. 2019-08-07 16:56:00 +00:00
fsck_msdosfs Avoid mixing cluster numbers and sector numbers. Makes code more readable. 2019-09-15 19:41:54 +00:00
fsdb
fsirand
gbde
geom
ggate Fix typo not -> nor and add 'the' because we are talking about specific flags 2019-09-06 15:01:47 +00:00
growfs
gvinum
hastctl
hastd
ifconfig ifconfig: add report of the string from SIOCGIFDOWNREASON. 2019-09-17 18:51:10 +00:00
init add ability to set watchdog timeout for a shutdown 2019-10-03 11:23:10 +00:00
ipf Create a link to the ipmon.conf.5 man page as documented in ipmon.5. 2019-06-27 12:37:44 +00:00
ipfw ipfw: fix jail option after r348215 2019-08-05 00:08:25 +00:00
iscontrol Fix formatting. 2019-08-08 20:56:52 +00:00
kldconfig
kldload
kldstat
kldunload
ldconfig
md5
mdconfig
mdmfs
mknod
mksnap_ffs
mount Add two options to allow mount to avoid covering up existing mount points. 2019-09-23 04:28:07 +00:00
mount_cd9660
mount_fusefs mount_fusefs: fix a segfault on memory allocation failure 2019-09-07 21:49:01 +00:00
mount_msdosfs
mount_nfs
mount_nullfs
mount_udf
mount_unionfs
natd
newfs Correct the location of the first backup superblock in fsck_ffs.8. 2019-08-07 16:56:00 +00:00
newfs_msdos When creating a new FAT32 filesystem, use "unknown" (0xFFFFFFFF) for 2019-08-22 06:14:06 +00:00
nfsiod pkgbase: Create a FreeBSD-utilities package and make it the default one 2019-09-05 14:15:47 +00:00
nos-tun pkgbase: Create a FreeBSD-utilities package and make it the default one 2019-09-05 14:15:47 +00:00
nvmecontrol Size is unsigned, so remove the test entirely. 2019-09-25 07:51:30 +00:00
pfctl pkgbase: pfctl: tests: Put tests files in the FreeBSD-tests package 2019-09-05 14:19:06 +00:00
pfilctl
pflogd
ping ping: Verify whether a datagram timestamp was actually received. 2019-09-11 18:54:45 +00:00
ping6 ping6: Use caph_rights_limit(3) for STDIN_FILENO 2019-09-23 22:20:11 +00:00
quotacheck
rcorder pkgbase: Move rc scripts and related files to their own packages 2019-09-05 14:08:45 +00:00
reboot Update the manpage text to show the output generated by the first-stage 2019-04-30 17:42:05 +00:00
recoverdisk
resolvconf
restore
route
routed
rtsol
savecore
sconfig
setkey pkgbase: Create a FreeBSD-utilities package and make it the default one 2019-09-05 14:15:47 +00:00
shutdown
spppcontrol
sunlabel Remove deprecated GEOM classes 2019-08-13 20:06:55 +00:00
swapon swap_pager.c reserves 2 blocks for a bsd label. Change that 2 to the 2019-08-15 02:30:44 +00:00
sysctl
tests
tunefs
umount
veriexec
zfsbootcfg
Makefile Remove NAND and NANDFS support 2019-06-25 04:50:09 +00:00
Makefile.amd64
Makefile.arm
Makefile.i386
Makefile.inc
Makefile.mips
Makefile.powerpc64
Makefile.sparc64