Some NFS server V4 questions
Konstantin Belousov
kostikbel at gmail.com
Sun Oct 26 12:41:19 UTC 2014
On Sun, Oct 26, 2014 at 08:14:05AM -0400, Rick Macklem wrote:
> Beeblebrox wrote:
> > Sorry guys, we have a considerable time-zone difference.
> >
> > >> It appears that the sysctl must be set before mountd, nfsd are
> > >> started to take effect. (Or they must be restarted after it is
> > >> set.)
> > I had apparently re-started nfsd but not mountd. This time
> > re-starting both and launching the PXE client fails at mount_root
> > stage as expected:
> > exec /sbin/init: error 43
> > exec /rescue/init: error 43
> > panic: no init
> >
> > One cannot set "sysctl vfs.nfsd.server_min_nfsvers=4" until one of
> > mountd/nfsd is started however, otherwise it gives an error. I have
> > not tried, but I suppose this error does not happen when placeed in
> > /etc/sysctl.conf?
> > sysctl: unknown oid 'vfs.nfsd.server_min_nfsvers': No such file or
> > directory
> >
> It works if it is /etc/sysctl.conf if "options NFSD" are specified
> for the kernel, which is what GENERIC for i386 has.
>
> If "options NFSD" isn't in your kernel config, I think you'd have to
> get nfsd.ko loaded before setting the sysctl and do both before
> starting mountd.
>
> I don't know of a clean way to do this?
>
> Putting kldload and sysctl command lines in mountd_precmd() in
> /etc/rc.d/mountd would do it I suspect. Maybe rc variables for
> this should be added? (I haven't tried this since the only
> kernels I have handy have "options NFSD" in them.)
With the following patch, the same variables should work when
set from the loader.conf (i.e. pre-boot) or using kenv(8).
diff --git a/sys/fs/nfsserver/nfs_nfsdkrpc.c b/sys/fs/nfsserver/nfs_nfsdkrpc.c
index d2145cc..4fb9c93 100644
--- a/sys/fs/nfsserver/nfs_nfsdkrpc.c
+++ b/sys/fs/nfsserver/nfs_nfsdkrpc.c
@@ -85,16 +85,16 @@ SYSCTL_DECL(_vfs_nfsd);
SVCPOOL *nfsrvd_pool;
static int nfs_privport = 0;
-SYSCTL_INT(_vfs_nfsd, OID_AUTO, nfs_privport, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, nfs_privport, CTLFLAG_RWTUN,
&nfs_privport, 0,
"Only allow clients using a privileged port for NFSv2 and 3");
static int nfs_minvers = NFS_VER2;
-SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_min_nfsvers, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_min_nfsvers, CTLFLAG_RWTUN,
&nfs_minvers, 0, "The lowest version of NFS handled by the server");
static int nfs_maxvers = NFS_VER4;
-SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_RW,
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_max_nfsvers, CTLFLAG_RWTUN,
&nfs_maxvers, 0, "The highest version of NFS handled by the server");
static int nfs_proc(struct nfsrv_descript *, u_int32_t, SVCXPRT *xprt,
More information about the freebsd-current
mailing list