Date: Sun, 26 Oct 2014 14:41:09 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Rick Macklem <rmacklem@uoguelph.ca> Cc: freebsd-current@freebsd.org, Beeblebrox <zaphod@berentweb.com> Subject: Re: Some NFS server V4 questions Message-ID: <20141026124109.GR1877@kib.kiev.ua> In-Reply-To: <1990486074.7623473.1414325645061.JavaMail.root@uoguelph.ca> References: <20141026104814.6f72435c@rsbsd.rsb> <1990486074.7623473.1414325645061.JavaMail.root@uoguelph.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
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,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141026124109.GR1877>