Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit d1ca8f1

Browse files
committed
add docs to primary processes. make rpc.statd print to console during debug
1 parent e35ea4b commit d1ca8f1

File tree

1 file changed

+68
-7
lines changed

1 file changed

+68
-7
lines changed

entrypoint.sh

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,11 @@ boot_main_exportfs() {
606606

607607
boot_main_mountd() {
608608

609+
# https://linux.die.net/man/8/rpc.mountd
610+
#
611+
# --debug turn on debugging. Valid kinds are: all, auth, call, general and parse.
612+
# --port specifies the port number used for RPC listener sockets
613+
609614
local version_flags
610615
read -r -a version_flags <<< "$(boot_helper_get_version_flags)"
611616
local -r port="${state[$STATE_MOUNTD_PORT]}"
@@ -620,10 +625,19 @@ boot_main_mountd() {
620625

621626
boot_main_rpcbind() {
622627

623-
# rpcbind isn't required for NFSv4, but if it's not running then nfsd takes over 5 minutes to start up.
624-
# it's a bug in either nfs-utils or the kernel, and the code of both is over my head.
625-
# so as a workaround we start rpcbind now and (in v4-only scenarios) kill it after nfsd starts up
626-
local -r args=('-ds')
628+
# https://linux.die.net/man/8/rpcbind
629+
#
630+
# -d run in debug mode. in this mode, rpcbind will not fork when it starts, will print additional information during
631+
# operation, and will abort on certain errors if -a is also specified. with this option, the name-to-address
632+
# translation consistency checks are shown in detail
633+
# -s cause rpcbind to change to the user daemon as soon as possible. this causes rpcbind to use non-privileged ports
634+
# for outgoing connections, preventing non-privileged clients from using rpcbind to connect to services from a
635+
# privileged port
636+
637+
local args=('-s')
638+
if is_logging_debug; then
639+
arg+=('-d')
640+
fi
627641
boot_helper_start_daemon 'starting rpcbind' $PATH_BIN_RPCBIND "${args[@]}"
628642
}
629643

@@ -633,6 +647,12 @@ boot_main_idmapd() {
633647
return
634648
fi
635649

650+
# https://linux.die.net/man/8/rpc.idmapd
651+
#
652+
# -S Server-only: perform no idmapping for any NFS client, even if one is detected
653+
# -v increases the verbosity level (can be specified multiple times
654+
# -f runs rpc.idmapd in the foreground and prints all output to the terminal
655+
636656
local args=('-S')
637657
local func=boot_helper_start_daemon
638658
if is_logging_debug; then
@@ -649,15 +669,44 @@ boot_main_statd() {
649669
return
650670
fi
651671

672+
# https://linux.die.net/man/8/rpc.statd
673+
#
674+
# --no-syslog causes rpc.statd to write log messages on stderr instead of to the system log, if the -F option was
675+
# also specified
676+
# --foreground keeps rpc.statd attached to its controlling terminal so that NSM operation can be monitored
677+
# directly or run under a debugger. if this option is not specified, rpc.statd backgrounds itself
678+
# soon after it starts
679+
# --no-notify prevents rpc.statd from running the sm-notify command when it starts up, preserving the existing
680+
# NSM state number and monitor list
681+
# --outgoing-port specifies the source port number the sm-notify command should use when sending reboot notifications
682+
# --port specifies the port number used for RPC listener sockets
683+
652684
local -r port_in="${state[$STATE_STATD_PORT_IN]}"
653685
local -r port_out="${state[$STATE_STATD_PORT_OUT]}"
654-
local -r args=('--no-notify' '--port' "$port_in" '--outgoing-port' "$port_out")
686+
local args=('--no-notify' '--port' "$port_in" '--outgoing-port' "$port_out")
687+
local func=boot_helper_start_daemon
655688

656-
boot_helper_start_daemon "starting statd on port $port_in (outgoing from port $port_out)" $PATH_BIN_STATD "${args[@]}"
689+
if is_logging_debug; then
690+
args+=('--no-syslog' '--foreground')
691+
func=boot_helper_start_non_daemon
692+
fi
693+
694+
$func "starting statd on port $port_in (outgoing from port $port_out)" $PATH_BIN_STATD "${args[@]}"
657695
}
658696

659697
boot_main_nfsd() {
660698

699+
# https://linux.die.net/man/8/rpc.nfsd
700+
#
701+
# --debug enable logging of debugging messages
702+
# --port specify a diferent port to listen on for NFS requests. by default, rpc.nfsd will listen on port 2049
703+
# --tcp explicitly enable TCP connections from clients
704+
# --udp explicitly enable UCP connections from clients
705+
# nproc specify the number of NFS server threads. by default, just one thread is started. however, for optimum
706+
# performance several threads should be used. the actual figure depends on the number of and the work load
707+
# created by the NFS clients, but a useful starting point is 8 threads. effects of modifying that number can
708+
# be checked using the nfsstat(8) program
709+
661710
local version_flags
662711
read -r -a version_flags <<< "$(boot_helper_get_version_flags)"
663712
local -r threads="${state[$STATE_NFSD_THREAD_COUNT]}"
@@ -670,6 +719,9 @@ boot_main_nfsd() {
670719

671720
boot_helper_start_daemon "starting rpc.nfsd on port $port with $threads server thread(s)" $PATH_BIN_NFSD "${args[@]}"
672721

722+
# rpcbind isn't required for NFSv4, but if it's not running then nfsd takes over 5 minutes to start up.
723+
# it's a bug in either nfs-utils or the kernel, and the code of both is over my head.
724+
# so as a workaround we start rpcbind always and (in v4-only scenarios) kill it after nfsd starts up
673725
if ! is_nfs3_enabled; then
674726
term_process "$PATH_BIN_RPCBIND"
675727
fi
@@ -681,9 +733,18 @@ boot_main_svcgssd() {
681733
return
682734
fi
683735

736+
# https://linux.die.net/man/8/rpc.svcgssd
737+
#
738+
# -f runs rpc.svcgssd in the foreground and sends output to stderr (as opposed to syslogd)
739+
# -v increases the verbosity of the output (can be specified multiple times)
740+
# -r if the rpcsec_gss library supports setting debug level, increases the verbosity of the output (can be specified
741+
# multiple times)
742+
# -i if the nfsidmap library supports setting debug level, increases the verbosity of the output (can be specified
743+
# multiple times)
744+
684745
local args=('-f')
685746
if is_logging_debug; then
686-
args+=('-vvv')
747+
args+=('-vvv' '-rrr' '-iii')
687748
fi
688749

689750
boot_helper_start_non_daemon 'starting rpc.svcgssd' $PATH_BIN_RPC_SVCGSSD "${args[@]}"

0 commit comments

Comments
 (0)