diff mbox

[03/15] Add /etc/nfs.conf support to rpc.nfsd

Message ID 148065110833.28046.2561331715736018574.stgit@noble (mailing list archive)
State New, archived
Headers show

Commit Message

NeilBrown Dec. 2, 2016, 3:58 a.m. UTC
I haven't added -H support, but everything else should be able to be
set through /etc/nfs.conf.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 systemd/nfs.conf.man |   24 ++++++++++++++++++++++++
 utils/nfsd/nfsd.c    |   36 ++++++++++++++++++++++++++++++++++++
 utils/nfsd/nfsd.man  |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 106 insertions(+), 3 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

J. Bruce Fields Dec. 5, 2016, 10:27 p.m. UTC | #1
On Fri, Dec 02, 2016 at 02:58:28PM +1100, NeilBrown wrote:
> I haven't added -H support, but everything else should be able to be
> set through /etc/nfs.conf.

I'm unclear--is this just a temporary omission for the purposes of this
RFC, or is there some reason you think -H shouldn't be set in nfs.conf?

--b.

> 
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  systemd/nfs.conf.man |   24 ++++++++++++++++++++++++
>  utils/nfsd/nfsd.c    |   36 ++++++++++++++++++++++++++++++++++++
>  utils/nfsd/nfsd.man  |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
>  3 files changed, 106 insertions(+), 3 deletions(-)
> 
> diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
> index 1f524d8fe74e..6ac6c65a81d9 100644
> --- a/systemd/nfs.conf.man
> +++ b/systemd/nfs.conf.man
> @@ -76,8 +76,32 @@ file is the only way to configure this program.  See
>  .BR nfsdcltrack (8)
>  for details.
>  
> +.TP
> +.B nfsd
> +Recognized values:
> +.BR threads ,
> +.BR grace-time ,
> +.BR lease-time ,
> +.BR udp ,
> +.BR tcp ,
> +.BR vers2 ,
> +.BR vers3 ,
> +.BR vers4 ,
> +.BR vers4.0 ,
> +.BR vers4.1 ,
> +.BR vers4.2 ,
> +.BR rdma .
> +
> +Version and protocol values are Boolean values as described above.
> +Threads and the two times are integers.
> +.B rdma
> +is a service name or number.  See
> +.BR rpc.nfsd (8)
> +for details.
> +
>  .SH FILES
>  .I /etc/nfs.conf
>  .SH SEE ALSO
>  .BR nfsdcltrack (8),
> +.BR rpc.nfsd (8),
>  .BR nfsmount.conf (5).
> diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
> index 9a65877f30c3..62b2876948c3 100644
> --- a/utils/nfsd/nfsd.c
> +++ b/utils/nfsd/nfsd.c
> @@ -24,6 +24,7 @@
>  #include <netinet/in.h>
>  #include <arpa/inet.h>
>  
> +#include "conffile.h"
>  #include "nfslib.h"
>  #include "nfssvc.h"
>  #include "xlog.h"
> @@ -33,6 +34,8 @@
>  #define NFSD_NPROC 8
>  #endif
>  
> +char *conf_path = NFS_CONFFILE;
> +
>  static void	usage(const char *);
>  
>  static struct option longopts[] =
> @@ -76,6 +79,39 @@ main(int argc, char **argv)
>  	xlog_syslog(0);
>  	xlog_stderr(1);
>  
> +	conf_init();
> +	count = conf_get_num("nfsd", "threads", count);
> +	grace = conf_get_num("nfsd", "grace-time", grace);
> +	lease = conf_get_num("nfsd", "lease-time", lease);
> +	rdma_port = conf_get_str("nfsd", "rdma");
> +	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(protobits)))
> +		NFSCTL_UDPSET(protobits);
> +	else
> +		NFSCTL_UDPUNSET(protobits);
> +	if (conf_get_bool("nfsd", "tcp", NFSCTL_TCPISSET(protobits)))
> +		NFSCTL_TCPSET(protobits);
> +	else
> +		NFSCTL_TCPUNSET(protobits);
> +	for (i = 2; i <= 4; i++) {
> +		char tag[10];
> +		sprintf(tag, "vers%d", i);
> +		if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(versbits, i)))
> +			NFSCTL_VERSET(versbits, i);
> +		else
> +			NFSCTL_VERUNSET(versbits, i);
> +	}
> +	/* We assume the kernel will default all minor versions to 'on',
> +	 * and allow the config file to disable some.
> +	 */
> +	for (i = 0; i <= NFS4_MAXMINOR; i++) {
> +		char tag[20];
> +		sprintf(tag, "vers4.%d", i);
> +		if (!conf_get_bool("nfsd", tag, 1)) {
> +			NFSCTL_VERSET(minorversset, i);
> +			NFSCTL_VERUNSET(minorversset, i);
> +		}
> +	}
> +
>  	while ((c = getopt_long(argc, argv, "dH:hN:V:p:P:sTUrG:L:", longopts, NULL)) != EOF) {
>  		switch(c) {
>  		case 'd':
> diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
> index 3ba847e2938f..7b9fbf21a947 100644
> --- a/utils/nfsd/nfsd.man
> +++ b/utils/nfsd/nfsd.man
> @@ -95,11 +95,11 @@ New file open requests (NFSv4) and new file locks (NLM) will not be
>  allowed until after this time has passed to allow clients to recover state.
>  .TP
>  .I nproc
> -specify the number of NFS server threads. By default, just one
> -thread is started. However, for optimum performance several threads
> +specify the number of NFS server threads. By default, eight
> +threads are started. However, for optimum performance several threads
>  should be used. The actual figure depends on the number of and the work
>  load created by the NFS clients, but a useful starting point is
> -8 threads. Effects of modifying that number can be checked using
> +eight threads. Effects of modifying that number can be checked using
>  the
>  .BR nfsstat (8)
>  program.
> @@ -114,6 +114,48 @@ In particular
>  .B rpc.nfsd 0
>  will stop all threads and thus close any open connections.
>  
> +.SH CONFIGURATION FILE
> +Many of the options that can be set on the command line can also be
> +controlled through values set in the
> +.B [nfsd]
> +section of the
> +.I /etc/nfs.conf
> +configuration file.  Values recognized include:
> +.TP
> +.B threads
> +The number of threads to start.
> +.TP
> +.B grace-time
> +The grace time, for both NFSv4 and NLM, in seconds.
> +.TP
> +.B lease-time
> +The lease time for NFSv4, in seconds.
> +.TP
> +.B rdma
> +Set RDMA port.  Use "rdma=nfsrdma" to enable standard port.
> +.TP
> +.B UDP
> +Enable (with "on" or "yes" etc) or disable ("off", "no") UDP support.
> +.TP
> +.B TCP
> +Enable or disable TCP support.
> +.TP
> +.B vers2
> +.TP
> +.B vers3
> +.TP
> +.B vers4
> +Enable or disable a major NFS version.  3 and 4 are normally enabled
> +by default.
> +.TP
> +.B vers4.1
> +.TP
> +.B vers4.2
> +.TP
> +.B vers4.3
> +Setting these to "off" or similar will disable the selected minor
> +versions.  All are enabled by default.
> +
>  .SH NOTES
>  If the program is built with TI-RPC support, it will enable any protocol and
>  address family combinations that are marked visible in the
> @@ -125,6 +167,7 @@ database.
>  .BR rpc.mountd (8),
>  .BR exports (5),
>  .BR exportfs (8),
> +.BR nfs.conf (5),
>  .BR rpc.rquotad (8),
>  .BR nfsstat (8),
>  .BR netconfig(5).
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
NeilBrown Dec. 5, 2016, 10:42 p.m. UTC | #2
On Tue, Dec 06 2016, J. Bruce Fields wrote:

> On Fri, Dec 02, 2016 at 02:58:28PM +1100, NeilBrown wrote:
>> I haven't added -H support, but everything else should be able to be
>> set through /etc/nfs.conf.
>
> I'm unclear--is this just a temporary omission for the purposes of this
> RFC, or is there some reason you think -H shouldn't be set in nfs.conf?
>

Temporary omission.
I would need to decide how to store a list in nfs.conf.
1/
  [nfsd]
  host = foo
  host = bar

2/
  [nfsd]
    host = foo, bar

3/ ??

and I suspect that any -H on the command line would over-ride all host=
in nfs.conf, but I'm not certain.
I'm sure there is a good, defensible solution here, but I didn't want to
spend time on it for the RFC.

Thanks,
NeilBrown
Steve Dickson Dec. 6, 2016, 5:52 p.m. UTC | #3
On 12/01/2016 10:58 PM, NeilBrown wrote:
> I haven't added -H support, but everything else should be able to be
> set through /etc/nfs.conf.
> 
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  systemd/nfs.conf.man |   24 ++++++++++++++++++++++++
>  utils/nfsd/nfsd.c    |   36 ++++++++++++++++++++++++++++++++++++
>  utils/nfsd/nfsd.man  |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
>  3 files changed, 106 insertions(+), 3 deletions(-)
> 
> diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
> index 1f524d8fe74e..6ac6c65a81d9 100644
> --- a/systemd/nfs.conf.man
> +++ b/systemd/nfs.conf.man
> @@ -76,8 +76,32 @@ file is the only way to configure this program.  See
>  .BR nfsdcltrack (8)
>  for details.
>  
> +.TP
> +.B nfsd
> +Recognized values:
> +.BR threads ,
> +.BR grace-time ,
> +.BR lease-time ,
> +.BR udp ,
> +.BR tcp ,
> +.BR vers2 ,
> +.BR vers3 ,
> +.BR vers4 ,
> +.BR vers4.0 ,
> +.BR vers4.1 ,
> +.BR vers4.2 ,
> +.BR rdma .
I'm curious as to what the criteria was as to
which options were defined. I would think 'debug'
and 'port' would have made the list.

steved.

> +
> +Version and protocol values are Boolean values as described above.
> +Threads and the two times are integers.
> +.B rdma
> +is a service name or number.  See
> +.BR rpc.nfsd (8)
> +for details.
> +
>  .SH FILES
>  .I /etc/nfs.conf
>  .SH SEE ALSO
>  .BR nfsdcltrack (8),
> +.BR rpc.nfsd (8),
>  .BR nfsmount.conf (5).
> diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
> index 9a65877f30c3..62b2876948c3 100644
> --- a/utils/nfsd/nfsd.c
> +++ b/utils/nfsd/nfsd.c
> @@ -24,6 +24,7 @@
>  #include <netinet/in.h>
>  #include <arpa/inet.h>
>  
> +#include "conffile.h"
>  #include "nfslib.h"
>  #include "nfssvc.h"
>  #include "xlog.h"
> @@ -33,6 +34,8 @@
>  #define NFSD_NPROC 8
>  #endif
>  
> +char *conf_path = NFS_CONFFILE;
> +
>  static void	usage(const char *);
>  
>  static struct option longopts[] =
> @@ -76,6 +79,39 @@ main(int argc, char **argv)
>  	xlog_syslog(0);
>  	xlog_stderr(1);
>  
> +	conf_init();
> +	count = conf_get_num("nfsd", "threads", count);
> +	grace = conf_get_num("nfsd", "grace-time", grace);
> +	lease = conf_get_num("nfsd", "lease-time", lease);
> +	rdma_port = conf_get_str("nfsd", "rdma");
> +	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(protobits)))
> +		NFSCTL_UDPSET(protobits);
> +	else
> +		NFSCTL_UDPUNSET(protobits);
> +	if (conf_get_bool("nfsd", "tcp", NFSCTL_TCPISSET(protobits)))
> +		NFSCTL_TCPSET(protobits);
> +	else
> +		NFSCTL_TCPUNSET(protobits);
> +	for (i = 2; i <= 4; i++) {
> +		char tag[10];
> +		sprintf(tag, "vers%d", i);
> +		if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(versbits, i)))
> +			NFSCTL_VERSET(versbits, i);
> +		else
> +			NFSCTL_VERUNSET(versbits, i);
> +	}
> +	/* We assume the kernel will default all minor versions to 'on',
> +	 * and allow the config file to disable some.
> +	 */
> +	for (i = 0; i <= NFS4_MAXMINOR; i++) {
> +		char tag[20];
> +		sprintf(tag, "vers4.%d", i);
> +		if (!conf_get_bool("nfsd", tag, 1)) {
> +			NFSCTL_VERSET(minorversset, i);
> +			NFSCTL_VERUNSET(minorversset, i);
> +		}
> +	}
> +
>  	while ((c = getopt_long(argc, argv, "dH:hN:V:p:P:sTUrG:L:", longopts, NULL)) != EOF) {
>  		switch(c) {
>  		case 'd':
> diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
> index 3ba847e2938f..7b9fbf21a947 100644
> --- a/utils/nfsd/nfsd.man
> +++ b/utils/nfsd/nfsd.man
> @@ -95,11 +95,11 @@ New file open requests (NFSv4) and new file locks (NLM) will not be
>  allowed until after this time has passed to allow clients to recover state.
>  .TP
>  .I nproc
> -specify the number of NFS server threads. By default, just one
> -thread is started. However, for optimum performance several threads
> +specify the number of NFS server threads. By default, eight
> +threads are started. However, for optimum performance several threads
>  should be used. The actual figure depends on the number of and the work
>  load created by the NFS clients, but a useful starting point is
> -8 threads. Effects of modifying that number can be checked using
> +eight threads. Effects of modifying that number can be checked using
>  the
>  .BR nfsstat (8)
>  program.
> @@ -114,6 +114,48 @@ In particular
>  .B rpc.nfsd 0
>  will stop all threads and thus close any open connections.
>  
> +.SH CONFIGURATION FILE
> +Many of the options that can be set on the command line can also be
> +controlled through values set in the
> +.B [nfsd]
> +section of the
> +.I /etc/nfs.conf
> +configuration file.  Values recognized include:
> +.TP
> +.B threads
> +The number of threads to start.
> +.TP
> +.B grace-time
> +The grace time, for both NFSv4 and NLM, in seconds.
> +.TP
> +.B lease-time
> +The lease time for NFSv4, in seconds.
> +.TP
> +.B rdma
> +Set RDMA port.  Use "rdma=nfsrdma" to enable standard port.
> +.TP
> +.B UDP
> +Enable (with "on" or "yes" etc) or disable ("off", "no") UDP support.
> +.TP
> +.B TCP
> +Enable or disable TCP support.
> +.TP
> +.B vers2
> +.TP
> +.B vers3
> +.TP
> +.B vers4
> +Enable or disable a major NFS version.  3 and 4 are normally enabled
> +by default.
> +.TP
> +.B vers4.1
> +.TP
> +.B vers4.2
> +.TP
> +.B vers4.3
> +Setting these to "off" or similar will disable the selected minor
> +versions.  All are enabled by default.
> +
>  .SH NOTES
>  If the program is built with TI-RPC support, it will enable any protocol and
>  address family combinations that are marked visible in the
> @@ -125,6 +167,7 @@ database.
>  .BR rpc.mountd (8),
>  .BR exports (5),
>  .BR exportfs (8),
> +.BR nfs.conf (5),
>  .BR rpc.rquotad (8),
>  .BR nfsstat (8),
>  .BR netconfig(5).
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Dickson Dec. 6, 2016, 6:51 p.m. UTC | #4
On 12/01/2016 10:58 PM, NeilBrown wrote:
> I haven't added -H support, but everything else should be able to be
> set through /etc/nfs.conf.
> 
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  systemd/nfs.conf.man |   24 ++++++++++++++++++++++++
>  utils/nfsd/nfsd.c    |   36 ++++++++++++++++++++++++++++++++++++
>  utils/nfsd/nfsd.man  |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
>  3 files changed, 106 insertions(+), 3 deletions(-)
> 
> diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
> index 1f524d8fe74e..6ac6c65a81d9 100644
> --- a/systemd/nfs.conf.man
> +++ b/systemd/nfs.conf.man
> @@ -76,8 +76,32 @@ file is the only way to configure this program.  See
>  .BR nfsdcltrack (8)
>  for details.
>  
> +.TP
> +.B nfsd
> +Recognized values:
> +.BR threads ,
> +.BR grace-time ,
> +.BR lease-time ,
> +.BR udp ,
> +.BR tcp ,
> +.BR vers2 ,
> +.BR vers3 ,
> +.BR vers4 ,
> +.BR vers4.0 ,
Do we need both ver4 and ver4.0?

steved.
> +.BR vers4.1 ,
> +.BR vers4.2 ,
> +.BR rdma .
> +
> +Version and protocol values are Boolean values as described above.
> +Threads and the two times are integers.
> +.B rdma
> +is a service name or number.  See
> +.BR rpc.nfsd (8)
> +for details.
> +
>  .SH FILES
>  .I /etc/nfs.conf
>  .SH SEE ALSO
>  .BR nfsdcltrack (8),
> +.BR rpc.nfsd (8),
>  .BR nfsmount.conf (5).
> diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
> index 9a65877f30c3..62b2876948c3 100644
> --- a/utils/nfsd/nfsd.c
> +++ b/utils/nfsd/nfsd.c
> @@ -24,6 +24,7 @@
>  #include <netinet/in.h>
>  #include <arpa/inet.h>
>  
> +#include "conffile.h"
>  #include "nfslib.h"
>  #include "nfssvc.h"
>  #include "xlog.h"
> @@ -33,6 +34,8 @@
>  #define NFSD_NPROC 8
>  #endif
>  
> +char *conf_path = NFS_CONFFILE;
> +
>  static void	usage(const char *);
>  
>  static struct option longopts[] =
> @@ -76,6 +79,39 @@ main(int argc, char **argv)
>  	xlog_syslog(0);
>  	xlog_stderr(1);
>  
> +	conf_init();
> +	count = conf_get_num("nfsd", "threads", count);
> +	grace = conf_get_num("nfsd", "grace-time", grace);
> +	lease = conf_get_num("nfsd", "lease-time", lease);
> +	rdma_port = conf_get_str("nfsd", "rdma");
> +	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(protobits)))
> +		NFSCTL_UDPSET(protobits);
> +	else
> +		NFSCTL_UDPUNSET(protobits);
> +	if (conf_get_bool("nfsd", "tcp", NFSCTL_TCPISSET(protobits)))
> +		NFSCTL_TCPSET(protobits);
> +	else
> +		NFSCTL_TCPUNSET(protobits);
> +	for (i = 2; i <= 4; i++) {
> +		char tag[10];
> +		sprintf(tag, "vers%d", i);
> +		if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(versbits, i)))
> +			NFSCTL_VERSET(versbits, i);
> +		else
> +			NFSCTL_VERUNSET(versbits, i);
> +	}
> +	/* We assume the kernel will default all minor versions to 'on',
> +	 * and allow the config file to disable some.
> +	 */
> +	for (i = 0; i <= NFS4_MAXMINOR; i++) {
> +		char tag[20];
> +		sprintf(tag, "vers4.%d", i);
> +		if (!conf_get_bool("nfsd", tag, 1)) {
> +			NFSCTL_VERSET(minorversset, i);
> +			NFSCTL_VERUNSET(minorversset, i);
> +		}
> +	}
> +
>  	while ((c = getopt_long(argc, argv, "dH:hN:V:p:P:sTUrG:L:", longopts, NULL)) != EOF) {
>  		switch(c) {
>  		case 'd':
> diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
> index 3ba847e2938f..7b9fbf21a947 100644
> --- a/utils/nfsd/nfsd.man
> +++ b/utils/nfsd/nfsd.man
> @@ -95,11 +95,11 @@ New file open requests (NFSv4) and new file locks (NLM) will not be
>  allowed until after this time has passed to allow clients to recover state.
>  .TP
>  .I nproc
> -specify the number of NFS server threads. By default, just one
> -thread is started. However, for optimum performance several threads
> +specify the number of NFS server threads. By default, eight
> +threads are started. However, for optimum performance several threads
>  should be used. The actual figure depends on the number of and the work
>  load created by the NFS clients, but a useful starting point is
> -8 threads. Effects of modifying that number can be checked using
> +eight threads. Effects of modifying that number can be checked using
>  the
>  .BR nfsstat (8)
>  program.
> @@ -114,6 +114,48 @@ In particular
>  .B rpc.nfsd 0
>  will stop all threads and thus close any open connections.
>  
> +.SH CONFIGURATION FILE
> +Many of the options that can be set on the command line can also be
> +controlled through values set in the
> +.B [nfsd]
> +section of the
> +.I /etc/nfs.conf
> +configuration file.  Values recognized include:
> +.TP
> +.B threads
> +The number of threads to start.
> +.TP
> +.B grace-time
> +The grace time, for both NFSv4 and NLM, in seconds.
> +.TP
> +.B lease-time
> +The lease time for NFSv4, in seconds.
> +.TP
> +.B rdma
> +Set RDMA port.  Use "rdma=nfsrdma" to enable standard port.
> +.TP
> +.B UDP
> +Enable (with "on" or "yes" etc) or disable ("off", "no") UDP support.
> +.TP
> +.B TCP
> +Enable or disable TCP support.
> +.TP
> +.B vers2
> +.TP
> +.B vers3
> +.TP
> +.B vers4
> +Enable or disable a major NFS version.  3 and 4 are normally enabled
> +by default.
> +.TP
> +.B vers4.1
> +.TP
> +.B vers4.2
> +.TP
> +.B vers4.3
> +Setting these to "off" or similar will disable the selected minor
> +versions.  All are enabled by default.
> +
>  .SH NOTES
>  If the program is built with TI-RPC support, it will enable any protocol and
>  address family combinations that are marked visible in the
> @@ -125,6 +167,7 @@ database.
>  .BR rpc.mountd (8),
>  .BR exports (5),
>  .BR exportfs (8),
> +.BR nfs.conf (5),
>  .BR rpc.rquotad (8),
>  .BR nfsstat (8),
>  .BR netconfig(5).
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
NeilBrown Dec. 6, 2016, 10:30 p.m. UTC | #5
On Wed, Dec 07 2016, Steve Dickson wrote:

> On 12/01/2016 10:58 PM, NeilBrown wrote:
>> I haven't added -H support, but everything else should be able to be
>> set through /etc/nfs.conf.
>> 
>> Signed-off-by: NeilBrown <neilb@suse.com>
>> ---
>>  systemd/nfs.conf.man |   24 ++++++++++++++++++++++++
>>  utils/nfsd/nfsd.c    |   36 ++++++++++++++++++++++++++++++++++++
>>  utils/nfsd/nfsd.man  |   49 ++++++++++++++++++++++++++++++++++++++++++++++---
>>  3 files changed, 106 insertions(+), 3 deletions(-)
>> 
>> diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
>> index 1f524d8fe74e..6ac6c65a81d9 100644
>> --- a/systemd/nfs.conf.man
>> +++ b/systemd/nfs.conf.man
>> @@ -76,8 +76,32 @@ file is the only way to configure this program.  See
>>  .BR nfsdcltrack (8)
>>  for details.
>>  
>> +.TP
>> +.B nfsd
>> +Recognized values:
>> +.BR threads ,
>> +.BR grace-time ,
>> +.BR lease-time ,
>> +.BR udp ,
>> +.BR tcp ,
>> +.BR vers2 ,
>> +.BR vers3 ,
>> +.BR vers4 ,
>> +.BR vers4.0 ,
>> +.BR vers4.1 ,
>> +.BR vers4.2 ,
>> +.BR rdma .
> I'm curious as to what the criteria was as to
> which options were defined. I would think 'debug'
> and 'port' would have made the list.

port should have made the list, it just .... didn't.

debug was more of a deliberate omission, or at least a deferral.
I didn't include debug for any daemons. mountd, nfsd, nfsdcltrack all
allow the option.  statd blends it with no-syslog. sm-notify has "-d".
mountd's --debug is different to the other, and takes word, as does
"exportfs -d".  The word is passed to xlog_sconfig can can select from
general, call, auth, parse, all.

Assuming that we want to be able to enable debug in the config file
(wouldn't you just run that command manually when you want to enable
debugging?) it would be good to standardize somehow.

So I guess I was treating "debug" like "host" - do it later.
I have no excuse for "port" :-(

NeilBrown
NeilBrown Dec. 6, 2016, 10:36 p.m. UTC | #6
On Wed, Dec 07 2016, Steve Dickson wrote:

>> +.B nfsd
>> +Recognized values:
>> +.BR threads ,
>> +.BR grace-time ,
>> +.BR lease-time ,
>> +.BR udp ,
>> +.BR tcp ,
>> +.BR vers2 ,
>> +.BR vers3 ,
>> +.BR vers4 ,
>> +.BR vers4.0 ,
> Do we need both ver4 and ver4.0?

"vers4" allows you to enable or disable v4 has a whole.
The assumption is that if enabled, all minor versions that the kernel
supports will be enabled by default.
vers4.x allows individual minor versions to be disabled, so
 vers4=yes
 vers4.0=no
would disable v4.0, just like "-V4 -N4.0"

I do wonder if this is ever valid though.  Why do we allow minor
versions to be enabled/disabled?
Does it make any sense to enable a non-contiguous set of minor versions?
Should we just have a maximum NFSv4 minor version?

I was trying to duplicate the current functionality as closely as
convenient.  That might not be best in this case.

Thanks,
NeilBrown


>
> steved.
>> +.BR vers4.1 ,
>> +.BR vers4.2 ,
>> +.BR rdma .
Steve Dickson Dec. 7, 2016, 2:34 p.m. UTC | #7
On 12/06/2016 05:30 PM, NeilBrown wrote:
>> I'm curious as to what the criteria was as to
>> which options were defined. I would think 'debug'
>> and 'port' would have made the list.
> port should have made the list, it just .... didn't.
Sure... I'll add it... 

> 
> debug was more of a deliberate omission, or at least a deferral.
> I didn't include debug for any daemons. mountd, nfsd, nfsdcltrack all
> allow the option.  statd blends it with no-syslog. sm-notify has "-d".
> mountd's --debug is different to the other, and takes word, as does
> "exportfs -d".  The word is passed to xlog_sconfig can can select from
> general, call, auth, parse, all.
For the ones that take a word, we could make debug=1 mean 
--debug all as the default. If other types of debug is 
need the command like can always be used. 

> 
> Assuming that we want to be able to enable debug in the config file
> (wouldn't you just run that command manually when you want to enable
> debugging?) it would be good to standardize somehow.
Hopefully through the nfs.conf file things can be standardized.
I'm not sure we want change command line arguments for
that reason though... 
 
> 
> So I guess I was treating "debug" like "host" - do it later.
> I have no excuse for "port" :-(
Sounds good... 

steved.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Dickson Dec. 7, 2016, 2:44 p.m. UTC | #8
On 12/06/2016 05:36 PM, NeilBrown wrote:
> On Wed, Dec 07 2016, Steve Dickson wrote:
> 
>>> +.B nfsd
>>> +Recognized values:
>>> +.BR threads ,
>>> +.BR grace-time ,
>>> +.BR lease-time ,
>>> +.BR udp ,
>>> +.BR tcp ,
>>> +.BR vers2 ,
>>> +.BR vers3 ,
>>> +.BR vers4 ,
>>> +.BR vers4.0 ,
>> Do we need both ver4 and ver4.0?
> 
> "vers4" allows you to enable or disable v4 has a whole.
> The assumption is that if enabled, all minor versions that the kernel
> supports will be enabled by default.
> vers4.x allows individual minor versions to be disabled, so
>  vers4=yes
>  vers4.0=no
> would disable v4.0, just like "-V4 -N4.0"
I see...

> 
> I do wonder if this is ever valid though.  Why do we allow minor
> versions to be enabled/disabled?
IDK... I think Trond did this... you know...
when in doubt... blame Trond! 8-) 
 
> Does it make any sense to enable a non-contiguous set of minor versions?
I don't think so... Talk about handing people rope! ;-)

> Should we just have a maximum NFSv4 minor version?
Maybe.. 

> 
> I was trying to duplicate the current functionality as closely as
> convenient.  That might not be best in this case.
You did a good job... this is definitely a nit.

steved.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bruce Fields Dec. 7, 2016, 6:08 p.m. UTC | #9
On Wed, Dec 07, 2016 at 09:44:25AM -0500, Steve Dickson wrote:
> 
> 
> On 12/06/2016 05:36 PM, NeilBrown wrote:
> > On Wed, Dec 07 2016, Steve Dickson wrote:
> > 
> >>> +.B nfsd
> >>> +Recognized values:
> >>> +.BR threads ,
> >>> +.BR grace-time ,
> >>> +.BR lease-time ,
> >>> +.BR udp ,
> >>> +.BR tcp ,
> >>> +.BR vers2 ,
> >>> +.BR vers3 ,
> >>> +.BR vers4 ,
> >>> +.BR vers4.0 ,
> >> Do we need both ver4 and ver4.0?
> > 
> > "vers4" allows you to enable or disable v4 has a whole.
> > The assumption is that if enabled, all minor versions that the kernel
> > supports will be enabled by default.
> > vers4.x allows individual minor versions to be disabled, so
> >  vers4=yes
> >  vers4.0=no
> > would disable v4.0, just like "-V4 -N4.0"
> I see...
> 
> > 
> > I do wonder if this is ever valid though.  Why do we allow minor
> > versions to be enabled/disabled?
> IDK... I think Trond did this... you know...
> when in doubt... blame Trond! 8-) 

Or Benny, 8daf220a6a83 "nfsd41: control nfsv4.1 svc via
/proc/fs/nfsd/versions".

> > Does it make any sense to enable a non-contiguous set of minor versions?
> I don't think so... Talk about handing people rope! ;-)

I can't think of a reason either.

> > Should we just have a maximum NFSv4 minor version?
> Maybe.. 

If you do that then I'd allow a minimum too.

--b.

> > I was trying to duplicate the current functionality as closely as
> > convenient.  That might not be best in this case.
> You did a good job... this is definitely a nit.
> 
> steved.
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
NeilBrown Dec. 7, 2016, 11:14 p.m. UTC | #10
On Thu, Dec 08 2016, "J. Bruce Fields" <bfields@redhat.com> wrote:

> On Wed, Dec 07, 2016 at 09:44:25AM -0500, Steve Dickson wrote:
>> > 
>> > I do wonder if this is ever valid though.  Why do we allow minor
>> > versions to be enabled/disabled?
>> IDK... I think Trond did this... you know...
>> when in doubt... blame Trond! 8-) 
>
> Or Benny, 8daf220a6a83 "nfsd41: control nfsv4.1 svc via
> /proc/fs/nfsd/versions".
>
>> > Does it make any sense to enable a non-contiguous set of minor versions?
>> I don't think so... Talk about handing people rope! ;-)
>
> I can't think of a reason either.
>
>> > Should we just have a maximum NFSv4 minor version?
>> Maybe.. 
>
> If you do that then I'd allow a minimum too.

Why?  I'm trying to understand why you would ever want to turn disable a
particular minor version.  I could equally well ask myself "why specify
a maximum"...

Benny's patch only suggests that it removes the need for
CONFIG_NFSD_V4_1, but why was that needed?
Maybe it is just to disable buggy code if some version is found to have
an inconvenient bug?  The client, by default, tries 4.2, then 4.1, then
4.0.  Older clients might start elsewhere.  So just disabling unreliable
versions individually does seem to make sense.

I note that Benny's original patch disabled v4.1 by default, and
required it to be explicitly enabled.  The current kernel enables all by
default, and requires them be explicitly disabled is required.
My current nfs.conf code will disabled unwanted minor versions, but not
enable any that are already disabled ... I guess I could fix that.

.... it is a shame that we can only enable/disable minor versions
when there are no nfsd threads running.  The justification for
failing if nfsd is active is fairly lame, and only applies
to major versions.  If minor versions could be changed at any time,
then it could be a simple function of rpc.nfsd, and the config
file would never need to enable things, only disable them.

Is there any other reason to disable minor versions, other than to avoid
buggy code (either in server or client)??


Actually.... I have a related question that I keep meaning to ask, but
haven't.

What are the circumstances where NFSv3 should be preferred over NFSv4
(assuming up-to-date kernels on server and client)?

I can think of:
 - NFSv3 is safer if you might need to support loop-back mounts
   as I don't think NFSv4 state management can reliably make forward
   progress against memory pressure.  In particular, creating the
   state-manager thread can deadlock waiting for an NFS write.

 - If you want fast-failover from one server to another,
   NFSv3 is probably faster as it only imposes the grace-time on
   lock requests.  NFSv4 imposes it on OPEN and so READ/WRITE
   as well.

 - NFSv3 is preferred if (for some weird reason) you need
   to use UDP.

Are there any others?  Are there any similar reasons to prefer a smaller
NFSv4 minor version over a larger one?

Thanks,
NeilBrown

>
> --b.
>
>> > I was trying to duplicate the current functionality as closely as
>> > convenient.  That might not be best in this case.
>> You did a good job... this is definitely a nit.
>> 
>> steved.
>>
Steve Dickson Dec. 8, 2016, 12:38 a.m. UTC | #11
On 12/07/2016 06:14 PM, NeilBrown wrote:
>> If you do that then I'd allow a minimum too.
> Why?  I'm trying to understand why you would ever want to turn disable a
> particular minor version.  I could equally well ask myself "why specify
> a maximum"...
I think I agree with this... Why put limits on what version
people can use.

> 
> Benny's patch only suggests that it removes the need for
> CONFIG_NFSD_V4_1, but why was that needed?
> Maybe it is just to disable buggy code if some version is found to have
> an inconvenient bug?  The client, by default, tries 4.2, then 4.1, then
> 4.0.  Older clients might start elsewhere.  So just disabling unreliable
> versions individually does seem to make sense.
> 
> I note that Benny's original patch disabled v4.1 by default, and
> required it to be explicitly enabled.  The current kernel enables all by
> default, and requires them be explicitly disabled is required.
I think it was to protect distros from enabling code 
they were not going to test. I remember it was a while until
RHEL6 enable the v4.1 code because we were not willing to
support it. 

> My current nfs.conf code will disabled unwanted minor versions, but not
> enable any that are already disabled ... I guess I could fix that.
I think disabling minor version for nfs.conf is perfect! 

But the only issue I see... how does one distribute that
configuration over thousands of servers/vms... that is
something we have never been good at... IMHO.
 
> 
> .... it is a shame that we can only enable/disable minor versions
> when there are no nfsd threads running.  The justification for
> failing if nfsd is active is fairly lame, and only applies
> to major versions.  If minor versions could be changed at any time,
> then it could be a simple function of rpc.nfsd, and the config
> file would never need to enable things, only disable them.
As you know rpc.nfsd is a hit and run command... It 
sets things up and then exits. I just don't see why there
would be a need to change the support of minor versions
on the fly? What about existing mounts?? Or maybe I'm
misunderstanding... 
 
> 
> Is there any other reason to disable minor versions, other than to avoid
> buggy code (either in server or client)??
There seems to be a history in Linux to be able to configure
exactly what you what in or out... Which is not a bad thing, IMHO. 
 
> 
> 
> Actually.... I have a related question that I keep meaning to ask, but
> haven't.
> 
> What are the circumstances where NFSv3 should be preferred over NFSv4
> (assuming up-to-date kernels on server and client)?
Good Question... This is worthy of a another thread! : -) 

> 
> I can think of:
>  - NFSv3 is safer if you might need to support loop-back mounts
>    as I don't think NFSv4 state management can reliably make forward
>    progress against memory pressure.  In particular, creating the
>    state-manager thread can deadlock waiting for an NFS write.
Agreed... v3 loopback make more sense that v4 mounts but 
what is the sense of doing NFS lookback mount in the
first place? Why not just do bind mount and be done with it! 

> 
>  - If you want fast-failover from one server to another,
>    NFSv3 is probably faster as it only imposes the grace-time on
>    lock requests.  NFSv4 imposes it on OPEN and so READ/WRITE
>    as well.
v3 will always be faster... IMHO... The less data to move will
always win the race. 

> 
>  - NFSv3 is preferred if (for some weird reason) you need
>    to use UDP.
Do you known anybody that is this position? As you know I'm
beating the path to turn off UDP support for all NFS daemons.

> 
> Are there any others?  Are there any similar reasons to prefer a smaller
> NFSv4 minor version over a larger one?
I'm thinking no... to the last question... v4.0 was the beginning,
v4.1 was better (recent server only support 4.1), and 4.2 has
features that will seriously improve performance...  
In theory :-) 

steved.  
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bruce Fields Dec. 9, 2016, 10:43 p.m. UTC | #12
On Thu, Dec 08, 2016 at 10:14:54AM +1100, NeilBrown wrote:
> On Thu, Dec 08 2016, "J. Bruce Fields" <bfields@redhat.com> wrote:
> 
> > On Wed, Dec 07, 2016 at 09:44:25AM -0500, Steve Dickson wrote:
> >> > 
> >> > I do wonder if this is ever valid though.  Why do we allow minor
> >> > versions to be enabled/disabled?
> >> IDK... I think Trond did this... you know...
> >> when in doubt... blame Trond! 8-) 
> >
> > Or Benny, 8daf220a6a83 "nfsd41: control nfsv4.1 svc via
> > /proc/fs/nfsd/versions".
> >
> >> > Does it make any sense to enable a non-contiguous set of minor versions?
> >> I don't think so... Talk about handing people rope! ;-)
> >
> > I can't think of a reason either.
> >
> >> > Should we just have a maximum NFSv4 minor version?
> >> Maybe.. 
> >
> > If you do that then I'd allow a minimum too.
> 
> Why?  I'm trying to understand why you would ever want to turn disable a
> particular minor version.  I could equally well ask myself "why specify
> a maximum"...

In the past setting a default maximum that's lower than the maximum
supported by the code has been a way to make new features available for
testers and early adopters while keeping other users safe.

For a minimum--I think "1" would be the most likely minimum, just
because there were some major changes made between 4.0 and 4.1, and
people might eventually want to enforce a policy of supporting only
versions >=4.1 in their environements.

And eventually, I don't know, maybe you really don't want clients
mounting unless they support labeled NFS, or something?  Though you
can't really force them to use new features.  I haven't really thought
it through.

> Benny's patch only suggests that it removes the need for
> CONFIG_NFSD_V4_1, but why was that needed?
> Maybe it is just to disable buggy code if some version is found to have
> an inconvenient bug?  The client, by default, tries 4.2, then 4.1, then
> 4.0.  Older clients might start elsewhere.  So just disabling unreliable
> versions individually does seem to make sense.
> 
> I note that Benny's original patch disabled v4.1 by default, and
> required it to be explicitly enabled.  The current kernel enables all by
> default, and requires them be explicitly disabled is required.
> My current nfs.conf code will disabled unwanted minor versions, but not
> enable any that are already disabled ... I guess I could fix that.

I think what that means is that the defaults are determined by the
kernel version you're running as opposed to by userspace.

The main reason for disabling minor versions has been immature code in
higher versions, and in that case I think it makes sense for the kernel
to provide the default: if you don't have a particular preference, I
think the choice of whether to run 4.1 or 4.0 probably depends on how
new your kernel is.

--b.

> .... it is a shame that we can only enable/disable minor versions
> when there are no nfsd threads running.  The justification for
> failing if nfsd is active is fairly lame, and only applies
> to major versions.  If minor versions could be changed at any time,
> then it could be a simple function of rpc.nfsd, and the config
> file would never need to enable things, only disable them.
> 
> Is there any other reason to disable minor versions, other than to avoid
> buggy code (either in server or client)??
> 
> 
> Actually.... I have a related question that I keep meaning to ask, but
> haven't.
> 
> What are the circumstances where NFSv3 should be preferred over NFSv4
> (assuming up-to-date kernels on server and client)?
> 
> I can think of:
>  - NFSv3 is safer if you might need to support loop-back mounts
>    as I don't think NFSv4 state management can reliably make forward
>    progress against memory pressure.  In particular, creating the
>    state-manager thread can deadlock waiting for an NFS write.
> 
>  - If you want fast-failover from one server to another,
>    NFSv3 is probably faster as it only imposes the grace-time on
>    lock requests.  NFSv4 imposes it on OPEN and so READ/WRITE
>    as well.
> 
>  - NFSv3 is preferred if (for some weird reason) you need
>    to use UDP.
> 
> Are there any others?  Are there any similar reasons to prefer a smaller
> NFSv4 minor version over a larger one?
> 
> Thanks,
> NeilBrown
> 
> >
> > --b.
> >
> >> > I was trying to duplicate the current functionality as closely as
> >> > convenient.  That might not be best in this case.
> >> You did a good job... this is definitely a nit.
> >> 
> >> steved.
> >> 


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
NeilBrown Dec. 20, 2016, 11:22 p.m. UTC | #13
On Wed, Dec 07 2016, NeilBrown wrote:

> [ Unknown signature status ]
> On Wed, Dec 07 2016, Steve Dickson wrote:
>
>>> +.B nfsd
>>> +Recognized values:
>>> +.BR threads ,
>>> +.BR grace-time ,
>>> +.BR lease-time ,
>>> +.BR udp ,
>>> +.BR tcp ,
>>> +.BR vers2 ,
>>> +.BR vers3 ,
>>> +.BR vers4 ,
>>> +.BR vers4.0 ,
>> Do we need both ver4 and ver4.0?
>
> "vers4" allows you to enable or disable v4 has a whole.
> The assumption is that if enabled, all minor versions that the kernel
> supports will be enabled by default.
> vers4.x allows individual minor versions to be disabled, so
>  vers4=yes
>  vers4.0=no
> would disable v4.0, just like "-V4 -N4.0"

What I meant here, of course, is
   just like "-V4 -N4.0" *should*

not "just like what it *does*."

To my surprise, when you actually try "nfsd -N4.0",
it opens /proc/fs/nfsd/versions and writes "+4.32".

#define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << ((_v) - 1))) 

That "-1" makes it clear that version 4.0 isn't understood.

The kernel side seem to understand that '0' is an independent minor version:
static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = {
	[0] = 1,
	[1] = 1,
	[2] = 1,
};

but refuses to let it be disabled:
				if (num != 4)
					return -EINVAL;
				minor = simple_strtoul(minorp+1, NULL, 0);
				if (minor == 0)
					return -EINVAL;

so you can have 4.1 disabled while 4.0 and 4.2 are active, but you
cannot disable 4.0 as well.

Should that be fixed?  Do we care?

At least we should change
					int i = atoi(p+1);
					if (i > NFS4_MAXMINOR) {
						fprintf(stderr, "%s: unsupported minor version\n", optarg);
						exit(1);

in nfsd.c so the test is
  if (i < NFS4_MINMINOR || i > NFS4_MAXMINOR) {

I'll send a patch.

Thanks,
NeilBrown
Bruce Fields Dec. 21, 2016, 1:55 a.m. UTC | #14
On Wed, Dec 21, 2016 at 10:22:24AM +1100, NeilBrown wrote:
> On Wed, Dec 07 2016, NeilBrown wrote:
> 
> > [ Unknown signature status ]
> > On Wed, Dec 07 2016, Steve Dickson wrote:
> >
> >>> +.B nfsd
> >>> +Recognized values:
> >>> +.BR threads ,
> >>> +.BR grace-time ,
> >>> +.BR lease-time ,
> >>> +.BR udp ,
> >>> +.BR tcp ,
> >>> +.BR vers2 ,
> >>> +.BR vers3 ,
> >>> +.BR vers4 ,
> >>> +.BR vers4.0 ,
> >> Do we need both ver4 and ver4.0?
> >
> > "vers4" allows you to enable or disable v4 has a whole.
> > The assumption is that if enabled, all minor versions that the kernel
> > supports will be enabled by default.
> > vers4.x allows individual minor versions to be disabled, so
> >  vers4=yes
> >  vers4.0=no
> > would disable v4.0, just like "-V4 -N4.0"
> 
> What I meant here, of course, is
>    just like "-V4 -N4.0" *should*
> 
> not "just like what it *does*."
> 
> To my surprise, when you actually try "nfsd -N4.0",
> it opens /proc/fs/nfsd/versions and writes "+4.32".
> 
> #define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << ((_v) - 1))) 
> 
> That "-1" makes it clear that version 4.0 isn't understood.
> 
> The kernel side seem to understand that '0' is an independent minor version:
> static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = {
> 	[0] = 1,
> 	[1] = 1,
> 	[2] = 1,
> };
> 
> but refuses to let it be disabled:
> 				if (num != 4)
> 					return -EINVAL;
> 				minor = simple_strtoul(minorp+1, NULL, 0);
> 				if (minor == 0)
> 					return -EINVAL;
> 
> so you can have 4.1 disabled while 4.0 and 4.2 are active, but you
> cannot disable 4.0 as well.
> 
> Should that be fixed?  Do we care?

It's not going to keep me up at night, but we should probably go ahead
and fix it, I can imagine somebody might care some day.

--b.

> 
> At least we should change
> 					int i = atoi(p+1);
> 					if (i > NFS4_MAXMINOR) {
> 						fprintf(stderr, "%s: unsupported minor version\n", optarg);
> 						exit(1);
> 
> in nfsd.c so the test is
>   if (i < NFS4_MINMINOR || i > NFS4_MAXMINOR) {
> 
> I'll send a patch.
> 
> Thanks,
> NeilBrown


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 1f524d8fe74e..6ac6c65a81d9 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -76,8 +76,32 @@  file is the only way to configure this program.  See
 .BR nfsdcltrack (8)
 for details.
 
+.TP
+.B nfsd
+Recognized values:
+.BR threads ,
+.BR grace-time ,
+.BR lease-time ,
+.BR udp ,
+.BR tcp ,
+.BR vers2 ,
+.BR vers3 ,
+.BR vers4 ,
+.BR vers4.0 ,
+.BR vers4.1 ,
+.BR vers4.2 ,
+.BR rdma .
+
+Version and protocol values are Boolean values as described above.
+Threads and the two times are integers.
+.B rdma
+is a service name or number.  See
+.BR rpc.nfsd (8)
+for details.
+
 .SH FILES
 .I /etc/nfs.conf
 .SH SEE ALSO
 .BR nfsdcltrack (8),
+.BR rpc.nfsd (8),
 .BR nfsmount.conf (5).
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 9a65877f30c3..62b2876948c3 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -24,6 +24,7 @@ 
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#include "conffile.h"
 #include "nfslib.h"
 #include "nfssvc.h"
 #include "xlog.h"
@@ -33,6 +34,8 @@ 
 #define NFSD_NPROC 8
 #endif
 
+char *conf_path = NFS_CONFFILE;
+
 static void	usage(const char *);
 
 static struct option longopts[] =
@@ -76,6 +79,39 @@  main(int argc, char **argv)
 	xlog_syslog(0);
 	xlog_stderr(1);
 
+	conf_init();
+	count = conf_get_num("nfsd", "threads", count);
+	grace = conf_get_num("nfsd", "grace-time", grace);
+	lease = conf_get_num("nfsd", "lease-time", lease);
+	rdma_port = conf_get_str("nfsd", "rdma");
+	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(protobits)))
+		NFSCTL_UDPSET(protobits);
+	else
+		NFSCTL_UDPUNSET(protobits);
+	if (conf_get_bool("nfsd", "tcp", NFSCTL_TCPISSET(protobits)))
+		NFSCTL_TCPSET(protobits);
+	else
+		NFSCTL_TCPUNSET(protobits);
+	for (i = 2; i <= 4; i++) {
+		char tag[10];
+		sprintf(tag, "vers%d", i);
+		if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(versbits, i)))
+			NFSCTL_VERSET(versbits, i);
+		else
+			NFSCTL_VERUNSET(versbits, i);
+	}
+	/* We assume the kernel will default all minor versions to 'on',
+	 * and allow the config file to disable some.
+	 */
+	for (i = 0; i <= NFS4_MAXMINOR; i++) {
+		char tag[20];
+		sprintf(tag, "vers4.%d", i);
+		if (!conf_get_bool("nfsd", tag, 1)) {
+			NFSCTL_VERSET(minorversset, i);
+			NFSCTL_VERUNSET(minorversset, i);
+		}
+	}
+
 	while ((c = getopt_long(argc, argv, "dH:hN:V:p:P:sTUrG:L:", longopts, NULL)) != EOF) {
 		switch(c) {
 		case 'd':
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
index 3ba847e2938f..7b9fbf21a947 100644
--- a/utils/nfsd/nfsd.man
+++ b/utils/nfsd/nfsd.man
@@ -95,11 +95,11 @@  New file open requests (NFSv4) and new file locks (NLM) will not be
 allowed until after this time has passed to allow clients to recover state.
 .TP
 .I nproc
-specify the number of NFS server threads. By default, just one
-thread is started. However, for optimum performance several threads
+specify the number of NFS server threads. By default, eight
+threads are started. However, for optimum performance several threads
 should be used. The actual figure depends on the number of and the work
 load created by the NFS clients, but a useful starting point is
-8 threads. Effects of modifying that number can be checked using
+eight threads. Effects of modifying that number can be checked using
 the
 .BR nfsstat (8)
 program.
@@ -114,6 +114,48 @@  In particular
 .B rpc.nfsd 0
 will stop all threads and thus close any open connections.
 
+.SH CONFIGURATION FILE
+Many of the options that can be set on the command line can also be
+controlled through values set in the
+.B [nfsd]
+section of the
+.I /etc/nfs.conf
+configuration file.  Values recognized include:
+.TP
+.B threads
+The number of threads to start.
+.TP
+.B grace-time
+The grace time, for both NFSv4 and NLM, in seconds.
+.TP
+.B lease-time
+The lease time for NFSv4, in seconds.
+.TP
+.B rdma
+Set RDMA port.  Use "rdma=nfsrdma" to enable standard port.
+.TP
+.B UDP
+Enable (with "on" or "yes" etc) or disable ("off", "no") UDP support.
+.TP
+.B TCP
+Enable or disable TCP support.
+.TP
+.B vers2
+.TP
+.B vers3
+.TP
+.B vers4
+Enable or disable a major NFS version.  3 and 4 are normally enabled
+by default.
+.TP
+.B vers4.1
+.TP
+.B vers4.2
+.TP
+.B vers4.3
+Setting these to "off" or similar will disable the selected minor
+versions.  All are enabled by default.
+
 .SH NOTES
 If the program is built with TI-RPC support, it will enable any protocol and
 address family combinations that are marked visible in the
@@ -125,6 +167,7 @@  database.
 .BR rpc.mountd (8),
 .BR exports (5),
 .BR exportfs (8),
+.BR nfs.conf (5),
 .BR rpc.rquotad (8),
 .BR nfsstat (8),
 .BR netconfig(5).