From owner-freebsd-current@FreeBSD.ORG Sun Oct 26 12:41:19 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71929246 for ; Sun, 26 Oct 2014 12:41:19 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14CF132F for ; Sun, 26 Oct 2014 12:41:18 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9QCf9nK016866 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 26 Oct 2014 14:41:09 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9QCf9nK016866 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9QCf9WF016865; Sun, 26 Oct 2014 14:41:09 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 26 Oct 2014 14:41:09 +0200 From: Konstantin Belousov To: Rick Macklem Subject: Re: Some NFS server V4 questions Message-ID: <20141026124109.GR1877@kib.kiev.ua> References: <20141026104814.6f72435c@rsbsd.rsb> <1990486074.7623473.1414325645061.JavaMail.root@uoguelph.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1990486074.7623473.1414325645061.JavaMail.root@uoguelph.ca> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: freebsd-current@freebsd.org, Beeblebrox X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Oct 2014 12:41:19 -0000 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,