aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2021-11-17 00:02:53 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2021-12-01 22:01:57 +0000
commit2cd26a286a9e6339a3c6782a7101cbbd5d166666 (patch)
tree9f9ab2ccddcb07c3c5ac1c93547a75785a522fa9
parent5cee383b87f5aa86912e6cf3158d74af4bb912f1 (diff)
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. (cherry picked from commit 5509bad74e44eed3b9d54fbd74d3752b88428147)
-rw-r--r--libexec/rc/rc.conf1
-rwxr-xr-xlibexec/rc/rc.d/nfsd6
2 files changed, 7 insertions, 0 deletions
diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf
index e4fc9a1d75fe..9336a9d91004 100644
--- a/libexec/rc/rc.conf
+++ b/libexec/rc/rc.conf
@@ -360,6 +360,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.
diff --git a/libexec/rc/rc.d/nfsd b/libexec/rc/rc.d/nfsd
index 1d0689b3beb7..b746cf7cea9d 100755
--- a/libexec/rc/rc.d/nfsd
+++ b/libexec/rc/rc.d/nfsd
@@ -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