An issue with nfsv4_server_enable=YES and /etc/rc.d/nfsd

Dimitry Andric dim at FreeBSD.org
Mon Oct 31 19:23:49 UTC 2011


Hi,

I recently experimented a bit with enabling NFSv4 on one of my -current
boxes.  While it worked fine eventually, I ran into a little snag:

Whenever you boot up your machine with nfsv4_server_enable=NO in
rc.conf, the /etc/rc.d/nfsd script sets vfs.nfsd.server_max_nfsvers to 3.

Then, when you set nfsv4_server_enable=YES, and restart nfsd via the
rc.d script, the sysctl does *not* get reset to max version 4, so NFSv4
still doesn't work!

Obviously, if you just reboot the machine, it will get reset to its
default value of 4 again, but it should not really be needed, just to
change this setting, right?

So I propose the attached patch, which resets server_max_nfsvers to 4,
whenever you set nfsv4_server_enable=YES in rc.conf.

I also added resetting of the nfs_privport sysctls, since this has the
same issue: nfs_reserved_port_only=YES sets the nfs_privport sysctl to
1, but in the other case, the sysctl doesn't get reset to 0.

Is this OK to commit?  Would also be nice to have in 9.0, I think.

P.S.: This looked good to rmacklem at .



More information about the freebsd-rc mailing list