nfsd: Add a new rc variable nfs_server_maxio

Since vfs.nfsd.srvmaxio can only be set when nfsd.ko
is loaded, but nfsd is not running, setting it in
/etc/sysctl.conf is not feasible when "options NFSD"
was not specified for the kernel.

This patch adds a new rc variable nfs_server_maxio,
which sets vfs.nfsd.srvmaxio at the correct time.

rc.conf.5 will be patched separately.

Reviewed by:	0mp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D32997
This commit is contained in:
Rick Macklem 2021-11-16 16:02:53 -08:00
parent d677d4be0c
commit 5509bad74e
2 changed files with 7 additions and 0 deletions

View File

@ -359,6 +359,7 @@ nfs_access_cache="60" # Client cache timeout in seconds
nfs_server_enable="NO" # This host is an NFS server (or NO).
nfs_server_flags="-u -t" # Flags to nfsd (if enabled).
nfs_server_managegids="NO" # The NFS server maps gids for AUTH_SYS (or NO).
nfs_server_maxio="131072" # Maximum I/O size for the nfsd.
mountd_enable="NO" # Run mountd (or NO).
mountd_flags="-r -S" # Flags to mountd (if NFS server enabled).
weak_mountd_authentication="NO" # Allow non-root mount requests to be served.

View File

@ -28,6 +28,12 @@ nfsd_precmd()
# oids are available.
load_kld nfsd || return 1
if [ -n "${nfs_server_maxio}" ]; then
if ! sysctl vfs.nfsd.srvmaxio=${nfs_server_maxio} >/dev/null; then
warn "Failed to set server max I/O"
fi
fi
if checkyesno nfs_reserved_port_only; then
echo 'NFS on reserved port only=YES'
sysctl vfs.nfsd.nfs_privport=1 > /dev/null