From: NeilBrown <neilb@suse.com>
To: "J. Bruce Fields" <bfields@redhat.com>,
Steve Dickson <SteveD@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 04/15] Add /etc/nfs.conf support for mountd.
Date: Fri, 02 Dec 2016 14:58:28 +1100 [thread overview]
Message-ID: <148065110853.28046.8252065251436176296.stgit@noble> (raw)
In-Reply-To: <148065078775.28046.5506130555300891075.stgit@noble>
Some values are taken from the [nfsd] section
to ensure consistency.
Signed-off-by: NeilBrown <neilb@suse.com>
---
systemd/nfs.conf.man | 22 +++++++++++++++++++++-
utils/mountd/mountd.c | 36 ++++++++++++++++++++++++++++++++++++
utils/mountd/mountd.man | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 6ac6c65a81d9..9fe9d0eff1fc 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -92,16 +92,36 @@ Recognized values:
.BR vers4.2 ,
.BR rdma .
-Version and protocol values are Boolean values as described above.
+Version and protocol values are Boolean values as described above,
+and are also used by
+.BR rpc.mountd .
Threads and the two times are integers.
.B rdma
is a service name or number. See
.BR rpc.nfsd (8)
for details.
+.TP
+.B mountd
+Recognized values:
+.BR manage-gids ,
+.BR descriptors ,
+.BR port ,
+.BR threads ,
+.BR reverse-lookup ,
+.BR state-directory-path ,
+.BR ha-callout .
+
+These, together with the protocol and version values in the
+.B [nfsd]
+section, are used to configure mountd. See
+.BR rpc.mountd (8)
+for details.
+
.SH FILES
.I /etc/nfs.conf
.SH SEE ALSO
.BR nfsdcltrack (8),
.BR rpc.nfsd (8),
+.BR rpc.mountd (8),
.BR nfsmount.conf (5).
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index d6cebbbd3920..2048fce92b8e 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -22,6 +22,8 @@
#include <fcntl.h>
#include <sys/resource.h>
#include <sys/wait.h>
+
+#include "conffile.h"
#include "xmalloc.h"
#include "misc.h"
#include "mountd.h"
@@ -38,6 +40,8 @@ int reverse_resolve = 0;
int manage_gids;
int use_ipaddr = -1;
+char *conf_path = NFS_CONFFILE;
+
/* PRC: a high-availability callout program can be specified with -H
* When this is done, the program will receive callouts whenever clients
* send mount or unmount requests -- the callout is not needed for 2.6 kernel */
@@ -654,6 +658,7 @@ main(int argc, char **argv)
{
char *state_dir = NFS_STATEDIR;
char *progname;
+ char *s;
unsigned int listeners = 0;
int foreground = 0;
int port = 0;
@@ -669,6 +674,37 @@ main(int argc, char **argv)
else
progname = argv[0];
+ conf_init();
+ manage_gids = conf_get_bool("mountd", "manage-gids", manage_gids);
+ descriptors = conf_get_num("mountd", "descriptors", descriptors);
+ port = conf_get_num("mountd", "port", port);
+ num_threads = conf_get_num("mountd", "threads", num_threads);
+ reverse_resolve = conf_get_bool("mountd", "reverse-lookup", reverse_resolve);
+ ha_callout_prog = conf_get_str("mountd", "ha-callout");
+
+ s = conf_get_str("mountd", "state-directory-path");
+ if (s)
+ state_dir = s;
+
+ /* NOTE: following uses "nfsd" section of nfs.conf !!!! */
+ if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(_rpcprotobits)))
+ NFSCTL_UDPSET(_rpcprotobits);
+ else
+ NFSCTL_UDPUNSET(_rpcprotobits);
+ if (conf_get_bool("nfsd", "tcp", NFSCTL_TCPISSET(_rpcprotobits)))
+ NFSCTL_TCPSET(_rpcprotobits);
+ else
+ NFSCTL_TCPUNSET(_rpcprotobits);
+ for (vers = 2; vers <= 4; vers++) {
+ char tag[10];
+ sprintf(tag, "vers%d", vers);
+ if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(nfs_version, vers)))
+ NFSCTL_VERSET(nfs_version, vers);
+ else
+ NFSCTL_VERUNSET(nfs_version, vers);
+ }
+
+
/* Parse the command line options and arguments. */
opterr = 0;
while ((c = getopt_long(argc, argv, "o:nFd:p:P:hH:N:V:vurs:t:g", longopts, NULL)) != EOF)
diff --git a/utils/mountd/mountd.man b/utils/mountd/mountd.man
index e0d1a0acba3a..9f0a51f2016e 100644
--- a/utils/mountd/mountd.man
+++ b/utils/mountd/mountd.man
@@ -199,6 +199,39 @@ the server. Note that the 'primary' group id is not affected so a
.B newgroup
command on the client will still be effective. This function requires
a Linux Kernel with version at least 2.6.21.
+
+.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 [mountd]
+or, in some cases, the
+.B [nfsd]
+sections of the
+.I /etc/nfs.conf
+configuration file.
+Values recognized in the
+.B [mountd]
+section include
+.BR manage-gids ,
+.BR descriptors ,
+.BR port ,
+.BR threads ,
+.BR reverse-lookup ", and"
+.BR state-directory-path ,
+.B ha-callout
+which each have the same effect as the option with the same name.
+
+The values recognized in the
+.B [nfsd]
+section include
+.BR TCP ,
+.BR UDP ,
+.BR vers2 ,
+.BR vers3 ", and"
+.B vers4
+which each have same same meaning as given by
+.BR rpc.nfsd (8).
+
.SH TCP_WRAPPERS SUPPORT
You can protect your
.B rpc.mountd
@@ -253,6 +286,7 @@ table of clients accessing server's exports
.BR rpc.nfsd (8),
.BR rpc.rquotad (8),
.BR nfs (5),
+.BR nfs.conf (5),
.BR tcpd (8),
.BR hosts_access (5),
.BR iptables (8),
next prev parent reply other threads:[~2016-12-02 3:59 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-02 3:58 [RFC PATCH 00/15] Enhance /etc/nfs.conf usage and remove nfs-config.service NeilBrown
2016-12-02 3:58 ` [PATCH 02/15] conffile: add bool support NeilBrown
2016-12-02 3:58 ` NeilBrown [this message]
2016-12-02 3:58 ` [PATCH 01/15] Add man-page describing /etc/nfs.conf NeilBrown
2016-12-02 3:58 ` [PATCH 03/15] Add /etc/nfs.conf support to rpc.nfsd NeilBrown
2016-12-05 22:27 ` J. Bruce Fields
2016-12-05 22:42 ` NeilBrown
2016-12-06 17:52 ` Steve Dickson
2016-12-06 22:30 ` NeilBrown
2016-12-07 14:34 ` Steve Dickson
2016-12-06 18:51 ` Steve Dickson
2016-12-06 22:36 ` NeilBrown
2016-12-07 14:44 ` Steve Dickson
2016-12-07 18:08 ` J. Bruce Fields
2016-12-07 23:14 ` NeilBrown
2016-12-08 0:38 ` Steve Dickson
2016-12-09 22:43 ` J. Bruce Fields
2016-12-20 23:22 ` NeilBrown
2016-12-21 1:55 ` J. Bruce Fields
2016-12-02 3:58 ` [PATCH 05/15] Add /etc/nfs.conf support for statd NeilBrown
2016-12-02 3:58 ` [PATCH 08/15] conffile: split loading of file into a separate function NeilBrown
2016-12-02 3:58 ` [PATCH 06/15] Add /etc/nfs.conf support for sm-notify NeilBrown
2016-12-02 3:58 ` [PATCH 11/15] conffile: ignore setting of empty string NeilBrown
2016-12-02 3:58 ` [PATCH 09/15] conffile: add support for include files NeilBrown
2016-12-02 3:58 ` [PATCH 10/15] conffile: strip "quotes" from values in conf file NeilBrown
2016-12-02 3:58 ` [PATCH 07/15] conffile: free image of config file after parsing NeilBrown
2016-12-02 3:58 ` [PATCH 13/15] statd: allow --no-notify to be passed via environment variable NeilBrown
2016-12-02 3:58 ` [PATCH 12/15] conffile: allow $name expansion of tag values NeilBrown
2016-12-02 3:58 ` [PATCH 14/15] systemd: Remove the nfs-config.service NeilBrown
2016-12-02 3:58 ` [PATCH 15/15] Add nfs.systemd man page NeilBrown
2016-12-02 15:56 ` [RFC PATCH 00/15] Enhance /etc/nfs.conf usage and remove nfs-config.service J. Bruce Fields
2016-12-06 16:55 ` Steve Dickson
2016-12-06 22:38 ` NeilBrown
2016-12-07 14:24 ` Steve Dickson
2016-12-06 17:26 ` J. Bruce Fields
2016-12-06 22:47 ` NeilBrown
2016-12-07 14:19 ` J. Bruce Fields
2016-12-06 19:25 ` Steve Dickson
2016-12-06 22:51 ` NeilBrown
2016-12-07 14:21 ` Steve Dickson
2016-12-20 18:33 ` Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=148065110853.28046.8252065251436176296.stgit@noble \
--to=neilb@suse.com \
--cc=SteveD@redhat.com \
--cc=bfields@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox