Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp459066ybl; Fri, 30 Aug 2019 02:21:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoMybqwOaDZOcqRRgSig/BCF1U8fd3jEr1G7x73JfydGVsfYTQOhZRKtViHPQDjGCwFrgy X-Received: by 2002:a62:d143:: with SMTP id t3mr12589284pfl.213.1567156902521; Fri, 30 Aug 2019 02:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567156902; cv=none; d=google.com; s=arc-20160816; b=V7MSeNDgLI2DY+cAefBNZ8Ql6UIW9SonzPEAiBnfuKxOJh5H2/VUNjelj5LQVDB3k+ I+4pbkY5ckliRNtfTf07dW9vHtCkMP2/h6vBK6DMIjQpvKkdaa5hOivzThsHYqxx8g7c qtbVuuxRdpFt7w6hYQeR69OaTfvAlBHWUVP/e3XW0Wlu7cXBmfM/mTbgov4DnBaFAfh2 1Q2YYzxmuQJJxOEfz28Gom1kiCOhPEgI3ao6oPBp+axT+mke6D7CZNEmLboZhpZ0Ebk7 yMBBEOng0PxbsfTPw3t+dHIYB3uBz689zroSmQ8F/7RAILTxVpt0hMIiee7RplkB43ym 50Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=hpbfMAnk9eMIRMN/LtsGUZArhpnMgTg/NgiEVQ+2YeE=; b=LcLSWZsenvr/mBLQByu1d44wPm1VHvjqtNHzjJ4M2n9NjijsbdtaX/+QcKa2+qg6Ra cfmG/SHM1l6f+uJrtd8qtHQGsySbShwSJuKjsjFg7sNCQS+EA+CQ+ESAc5BnBPHHN82D 4tceVAFN0MP465rRXDgcJ2CsPG+HdE8vyDmYydSDOcBXIPaevSkIMclPRvWyTUMwcXeG FXPKvySzsUzRai5AX7poIc9hbk2UjwE4Bb40ZGH2IZb7vZHqwdmwXUJ8WF5jHZQWfKfL 5OQy/VFNf/oRiwCdYn8XOaSalM1Ko4NaCK8nF1WgwXNueAvERrsq1FoRzbeCkd17GaT/ v8rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u14si4482822pjn.61.2019.08.30.02.21.17; Fri, 30 Aug 2019 02:21:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727521AbfH3JVC (ORCPT + 99 others); Fri, 30 Aug 2019 05:21:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55161 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727328AbfH3JVC (ORCPT ); Fri, 30 Aug 2019 05:21:02 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E3523307D91F; Fri, 30 Aug 2019 09:21:01 +0000 (UTC) Received: from localhost (dhcp-12-152.nay.redhat.com [10.66.12.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 598C9600F8; Fri, 30 Aug 2019 09:21:01 +0000 (UTC) From: Yongcheng Yang To: Steve Dickson Cc: linux-nfs@vger.kernel.org, Yongcheng Yang Subject: [PATCH 1/1] nfsd: Adjust nfs.conf setting/parsing of rdma port Date: Fri, 30 Aug 2019 17:20:58 +0800 Message-Id: <20190830092058.18021-1-yongcheng.yang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 30 Aug 2019 09:21:01 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- 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