bc9fd4
commit 0240df0e8ccf7be2706a6a10a2a620f8eda55275
bc9fd4
Author: Yongcheng Yang <yongcheng.yang@gmail.com>
bc9fd4
Date:   Thu Sep 5 07:36:26 2019 -0400
bc9fd4
bc9fd4
    nfsd: Adjust nfs.conf setting/parsing of rdma port
bc9fd4
    
bc9fd4
    The rpc.nfsd program can use option "--rdma" to enable
bc9fd4
    RDMA on the standard port (nfsrdma/20049) or "--rdma=port"
bc9fd4
    for an alternate port.
bc9fd4
    
bc9fd4
    But now in /etc/nfs.conf, we need to specify the port
bc9fd4
    number (e.g. rdma=nfsrdma) to enable it, which is not
bc9fd4
    convenient.
bc9fd4
    The default setting "rdma=n" may cause more confusion.
bc9fd4
    
bc9fd4
    Update to enable RDMA on standard port when setting
bc9fd4
    boolean YES to "rdma=". And using "rdma-port=" for an
bc9fd4
    alternate port if necessary.
bc9fd4
    
bc9fd4
    Also let previous config (e.g. rdma=nfsrdma) work as well.
bc9fd4
    
bc9fd4
    Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com>
bc9fd4
    Signed-off-by: Steve Dickson <steved@redhat.com>
bc9fd4
bc9fd4
diff --git a/nfs.conf b/nfs.conf
bc9fd4
index 85097fd..186a5b1 100644
bc9fd4
--- a/nfs.conf
bc9fd4
+++ b/nfs.conf
bc9fd4
@@ -63,6 +63,7 @@
bc9fd4
 # vers4.1=y
bc9fd4
 # vers4.2=y
bc9fd4
 # rdma=n
bc9fd4
+# rdma-port=20049
bc9fd4
 #
bc9fd4
 [statd]
bc9fd4
 # debug=0
bc9fd4
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
bc9fd4
index b256bd9..a412a02 100644
bc9fd4
--- a/utils/nfsd/nfsd.c
bc9fd4
+++ b/utils/nfsd/nfsd.c
bc9fd4
@@ -92,7 +92,14 @@ main(int argc, char **argv)
bc9fd4
 	port = conf_get_str("nfsd", "port");
bc9fd4
 	if (!port)
bc9fd4
 		port = "nfs";
bc9fd4
-	rdma_port = conf_get_str("nfsd", "rdma");
bc9fd4
+	if (conf_get_bool("nfsd", "rdma", false)) {
bc9fd4
+		rdma_port = conf_get_str("nfsd", "rdma-port");
bc9fd4
+		if (!rdma_port)
bc9fd4
+			rdma_port = "nfsrdma";
bc9fd4
+	}
bc9fd4
+	/* backward compatibility - nfs.conf used to set rdma port directly */
bc9fd4
+	if (!rdma_port)
bc9fd4
+		rdma_port = conf_get_str("nfsd", "rdma");
bc9fd4
 	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(protobits)))
bc9fd4
 		NFSCTL_UDPSET(protobits);
bc9fd4
 	else
bc9fd4
diff --git a/utils/nfsd/nfsd.man b/utils/nfsd/nfsd.man
bc9fd4
index d83ef86..2701ba7 100644
bc9fd4
--- a/utils/nfsd/nfsd.man
bc9fd4
+++ b/utils/nfsd/nfsd.man
bc9fd4
@@ -144,7 +144,11 @@ The lease time for NFSv4, in seconds.
bc9fd4
 Set the port for TCP/UDP to bind to.
bc9fd4
 .TP
bc9fd4
 .B rdma
bc9fd4
-Set RDMA port.  Use "rdma=nfsrdma" to enable standard port.
bc9fd4
+Enable RDMA port (with "on" or "yes" etc) on the standard port
bc9fd4
+("nfsrdma", port 20049).
bc9fd4
+.TP
bc9fd4
+.B rdma-port
bc9fd4
+Set an alternate RDMA port.
bc9fd4
 .TP
bc9fd4
 .B UDP
bc9fd4
 Enable (with "on" or "yes" etc) or disable ("off", "no") UDP support.