mountd startup: enable NFSv4 if needed on restart

The mountd script in rc.d sets vfs.nfsd.server_max_nfsvers correctly
when it is run at system startup, relying on the kernel default.
However, if NFSv4 was enabled in /etc/rc.conf later, and the script
was re-run to restart mountd, the sysctl was still set to 3.
Set the sysctl to the right value in all cases.

Reviewed by:	rmacklem
MFC after:	1 week
This commit is contained in:
Mike Karels 2022-07-03 18:04:41 -05:00
parent db4b40213a
commit 1cf8e6339e

View file

@ -34,7 +34,9 @@ mountd_precmd()
rc_flags="${rc_flags} -R"
else
force_depend rpcbind || return 1
if ! checkyesno nfsv4_server_enable; then
if checkyesno nfsv4_server_enable; then
sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
else
sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null
fi
fi