[Bug 270551] nfsd ignores vfs.nfsd.maxthreads at startup

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 30 Mar 2023 20:58:52 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270551

            Bug ID: 270551
           Summary: nfsd ignores vfs.nfsd.maxthreads at startup
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

The vfs.nfsd.maxthreads sysctl should control the maximum number of threads
that the nfs server creates.  Indeed it does, for nfs servers that are already
running.  But when nfsd starts up, it ignores this setting.  Instead, it
overwrites it based on the value of the --maxthreads argument or else it
somehow chooses a sensible default.

This behavior is unfortunate, since /etc/rc.d/sysctl runs before
/etc/rc.d/nfsd.  That means you can't use the sysctl to control nfsd's
behavior.

Should nfsd check the sysctl if maxthreads is unset, and use that value?

Steps to Reproduce
==================
# echo vfs.nfsd.maxthreads=128 >> /etc/sysctl.conf
# service sysctl restart
# sysctl vfs.nfsd.maxthreads
vfs.nfsd.maxthreads: 128
# service nfsd start
# sysctl vfs.nfsd.maxthreads
vfs.nfsd.maxthreads: 64

-- 
You are receiving this mail because:
You are the assignee for the bug.