linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] nfsd: Adjust nfs.conf setting/parsing of rdma port
@ 2019-08-30  9:20 Yongcheng Yang
  2019-09-05 11:37 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Yongcheng Yang @ 2019-08-30  9:20 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Yongcheng Yang

The rpc.nfsd program can use option "--rdma" to enable
RDMA on the standard port (nfsrdma/20049) or "--rdma=port"
for an alternate port.

But now in /etc/nfs.conf, we need to specify the port
number (e.g. rdma=nfsrdma) to enable it, which is not
convenient.
The default setting "rdma=n" may cause more confusion.

Update to enable RDMA on standard port when setting
boolean YES to "rdma=". And using "rdma-port=" for an
alternate port if necessary.

Also let previous config (e.g. rdma=nfsrdma) work as well.

Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com>
---
Hello SteveD,

I did some simple test:
~~~~~~~~~~~~~~~~~~~~~~~
[root@ rpc-nfsd]# cp rpc.nfsd.new /usr/sbin/rpc.nfsd
cp: overwrite '/usr/sbin/rpc.nfsd'? y
[root@ rpc-nfsd]# vi /etc/nfs.conf
[root@ rpc-nfsd]# cat /etc/nfs.conf
[nfsd]
rdma=nfsrdma      <<<<<<<<< previous pattern
[root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
[nfsd]
rdma 20049
rdma 20049
[root@ rpc-nfsd]# vi /etc/nfs.conf
[root@ rpc-nfsd]# cat /etc/nfs.conf
[nfsd]
rdma=y            <<<<<<<<< boolean YES
[root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
rdma 20049
rdma 20049
[root@ rpc-nfsd]# vi /etc/nfs.conf
[root@ rpc-nfsd]# cat /etc/nfs.conf
[nfsd]
rdma=n            <<<<<<<<< boolean NO
[root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
[root@ rpc-nfsd]# vi /etc/nfs.conf
[root@ rpc-nfsd]# cat /etc/nfs.conf
[nfsd]
rdma=12345        <<<<<<<<< previous pattern
[root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
rdma 12345
rdma 12345
[root@ rpc-nfsd]# vi /etc/nfs.conf
[root@ rpc-nfsd]# cat /etc/nfs.conf
[nfsd]
rdma=yes          <<<<<<<<< boolean YES
rdma-port=54321   <<<<<<<<< another port number
[root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
rdma 54321
rdma 54321
[root@ rpc-nfsd]# vi /etc/nfs.conf
[root@ rpc-nfsd]# cat /etc/nfs.conf
[nfsd]
rdma=n          <<<<<<<<< boolean NO won't enable it even with rdma-port set
rdma-port=54321
[root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
[root@ rpc-nfsd]# vi /etc/nfs.conf
[root@ rpc-nfsd]# cat /etc/nfs.conf
[nfsd]
#rdma=n
rdma-port=54321
[root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
[root@ rpc-nfsd]# 
~~~~~~~~~~~~~~~~~~~~~~~

Thanks,
Yongcheng

---
 nfs.conf            | 1 +
 utils/nfsd/nfsd.c   | 9 ++++++++-
 utils/nfsd/nfsd.man | 6 +++++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/nfs.conf b/nfs.conf
index 85097fd1..186a5b19 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -63,6 +63,7 @@
 # vers4.1=y
 # vers4.2=y
 # rdma=n
+# rdma-port=20049
 #
 [statd]
 # debug=0
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index b256bd9f..a412a026 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -92,7 +92,14 @@ main(int argc, char **argv)
 	port = conf_get_str("nfsd", "port");
 	if (!port)
 		port = "nfs";
-	rdma_port = conf_get_str("nfsd", "rdma");
+	if (conf_get_bool("nfsd", "rdma", false)) {
+		rdma_port = conf_get_str("nfsd", "rdma-port");
+		if (!rdma_port)
+			rdma_port = "nfsrdma";
+	}
+	/* backward compatibility - nfs.conf used to set rdma port directly */
+	if (!rdma_port)
+		rdma_port = conf_get_str("nfsd", "rdma");
 	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(protobits)))
 		NFSCTL_UDPSET(protobits);
 	else
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
index d83ef869..2701ba78 100644
--- a/utils/nfsd/nfsd.man
+++ b/utils/nfsd/nfsd.man
@@ -144,7 +144,11 @@ The lease time for NFSv4, in seconds.
 Set the port for TCP/UDP to bind to.
 .TP
 .B rdma
-Set RDMA port.  Use "rdma=nfsrdma" to enable standard port.
+Enable RDMA port (with "on" or "yes" etc) on the standard port
+("nfsrdma", port 20049).
+.TP
+.B rdma-port
+Set an alternate RDMA port.
 .TP
 .B UDP
 Enable (with "on" or "yes" etc) or disable ("off", "no") UDP support.
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] nfsd: Adjust nfs.conf setting/parsing of rdma port
  2019-08-30  9:20 [PATCH 1/1] nfsd: Adjust nfs.conf setting/parsing of rdma port Yongcheng Yang
@ 2019-09-05 11:37 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2019-09-05 11:37 UTC (permalink / raw)
  To: Yongcheng Yang; +Cc: linux-nfs



On 8/30/19 5:20 AM, Yongcheng Yang wrote:
> The rpc.nfsd program can use option "--rdma" to enable
> RDMA on the standard port (nfsrdma/20049) or "--rdma=port"
> for an alternate port.
> 
> But now in /etc/nfs.conf, we need to specify the port
> number (e.g. rdma=nfsrdma) to enable it, which is not
> convenient.
> The default setting "rdma=n" may cause more confusion.
> 
> Update to enable RDMA on standard port when setting
> boolean YES to "rdma=". And using "rdma-port=" for an
> alternate port if necessary.
> 
> Also let previous config (e.g. rdma=nfsrdma) work as well.
> 
> Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com>
Committed.... 

steved.

> ---
> Hello SteveD,
> 
> I did some simple test:
> ~~~~~~~~~~~~~~~~~~~~~~~
> [root@ rpc-nfsd]# cp rpc.nfsd.new /usr/sbin/rpc.nfsd
> cp: overwrite '/usr/sbin/rpc.nfsd'? y
> [root@ rpc-nfsd]# vi /etc/nfs.conf
> [root@ rpc-nfsd]# cat /etc/nfs.conf
> [nfsd]
> rdma=nfsrdma      <<<<<<<<< previous pattern
> [root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
> [nfsd]
> rdma 20049
> rdma 20049
> [root@ rpc-nfsd]# vi /etc/nfs.conf
> [root@ rpc-nfsd]# cat /etc/nfs.conf
> [nfsd]
> rdma=y            <<<<<<<<< boolean YES
> [root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
> rdma 20049
> rdma 20049
> [root@ rpc-nfsd]# vi /etc/nfs.conf
> [root@ rpc-nfsd]# cat /etc/nfs.conf
> [nfsd]
> rdma=n            <<<<<<<<< boolean NO
> [root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
> [root@ rpc-nfsd]# vi /etc/nfs.conf
> [root@ rpc-nfsd]# cat /etc/nfs.conf
> [nfsd]
> rdma=12345        <<<<<<<<< previous pattern
> [root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
> rdma 12345
> rdma 12345
> [root@ rpc-nfsd]# vi /etc/nfs.conf
> [root@ rpc-nfsd]# cat /etc/nfs.conf
> [nfsd]
> rdma=yes          <<<<<<<<< boolean YES
> rdma-port=54321   <<<<<<<<< another port number
> [root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
> rdma 54321
> rdma 54321
> [root@ rpc-nfsd]# vi /etc/nfs.conf
> [root@ rpc-nfsd]# cat /etc/nfs.conf
> [nfsd]
> rdma=n          <<<<<<<<< boolean NO won't enable it even with rdma-port set
> rdma-port=54321
> [root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
> [root@ rpc-nfsd]# vi /etc/nfs.conf
> [root@ rpc-nfsd]# cat /etc/nfs.conf
> [nfsd]
> #rdma=n
> rdma-port=54321
> [root@ rpc-nfsd]# systemctl restart nfs-server && cat /proc/fs/nfsd/portlist | grep -w rdma
> [root@ rpc-nfsd]# 
> ~~~~~~~~~~~~~~~~~~~~~~~
> 
> Thanks,
> Yongcheng
> 
> ---
>  nfs.conf            | 1 +
>  utils/nfsd/nfsd.c   | 9 ++++++++-
>  utils/nfsd/nfsd.man | 6 +++++-
>  3 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/nfs.conf b/nfs.conf
> index 85097fd1..186a5b19 100644
> --- a/nfs.conf
> +++ b/nfs.conf
> @@ -63,6 +63,7 @@
>  # vers4.1=y
>  # vers4.2=y
>  # rdma=n
> +# rdma-port=20049
>  #
>  [statd]
>  # debug=0
> diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
> index b256bd9f..a412a026 100644
> --- a/utils/nfsd/nfsd.c
> +++ b/utils/nfsd/nfsd.c
> @@ -92,7 +92,14 @@ main(int argc, char **argv)
>  	port = conf_get_str("nfsd", "port");
>  	if (!port)
>  		port = "nfs";
> -	rdma_port = conf_get_str("nfsd", "rdma");
> +	if (conf_get_bool("nfsd", "rdma", false)) {
> +		rdma_port = conf_get_str("nfsd", "rdma-port");
> +		if (!rdma_port)
> +			rdma_port = "nfsrdma";
> +	}
> +	/* backward compatibility - nfs.conf used to set rdma port directly */
> +	if (!rdma_port)
> +		rdma_port = conf_get_str("nfsd", "rdma");
>  	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(protobits)))
>  		NFSCTL_UDPSET(protobits);
>  	else
> diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
> index d83ef869..2701ba78 100644
> --- a/utils/nfsd/nfsd.man
> +++ b/utils/nfsd/nfsd.man
> @@ -144,7 +144,11 @@ The lease time for NFSv4, in seconds.
>  Set the port for TCP/UDP to bind to.
>  .TP
>  .B rdma
> -Set RDMA port.  Use "rdma=nfsrdma" to enable standard port.
> +Enable RDMA port (with "on" or "yes" etc) on the standard port
> +("nfsrdma", port 20049).
> +.TP
> +.B rdma-port
> +Set an alternate RDMA port.
>  .TP
>  .B UDP
>  Enable (with "on" or "yes" etc) or disable ("off", "no") UDP support.
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-05 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30  9:20 [PATCH 1/1] nfsd: Adjust nfs.conf setting/parsing of rdma port Yongcheng Yang
2019-09-05 11:37 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).