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