Linux NFS development
 help / color / mirror / Atom feed
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 14/15] systemd: Remove the nfs-config.service
Date: Fri, 02 Dec 2016 14:58:30 +1100	[thread overview]
Message-ID: <148065111026.28046.13765788515171931087.stgit@noble> (raw)
In-Reply-To: <148065078775.28046.5506130555300891075.stgit@noble>

Now that we have /etc/nfs.conf, a lot of configuration can be
read directly.  So nfs-config isn't really needed any more.

Some distributions allow command-line arguments for various
daemons to be set in an environment file (/etc/sysconfig, /etc/defaults).
Passing these through /etc/nfs.conf is not possible.

Instead, a distro that needs this functionality can create drop-in
files which select the required value.  As no commands are given
default arguments by systemd unit files, the drop-in can just add
distro-specific args.
For example
  /lib/systemd/system/nfs-mountd.service.d/local.conf
   [Service]
   EnvironmentFile=/etc/sysconfig/nfs
   ExecStart=
   ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDOPTS

Note the need for the empty assignment to remove existing definitions
first.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 configure.ac                     |    6 ------
 systemd/Makefile.am              |    1 -
 systemd/README                   |   22 +++++++++++++++-------
 systemd/nfs-blkmap.service       |    3 +--
 systemd/nfs-config.service.in    |   13 -------------
 systemd/nfs-idmapd.service       |    6 +-----
 systemd/nfs-mountd.service       |    6 +-----
 systemd/nfs-server.service       |    7 +------
 systemd/rpc-gssd.service.in      |    7 +------
 systemd/rpc-statd-notify.service |    6 +-----
 systemd/rpc-statd.service        |    6 +-----
 systemd/rpc-svcgssd.service      |    6 +-----
 12 files changed, 23 insertions(+), 66 deletions(-)
 delete mode 100644 systemd/nfs-config.service.in

diff --git a/configure.ac b/configure.ac
index 8a5aa2e5203b..b3388a62fe30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -518,11 +518,6 @@ AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
 # Make sure that $ACLOCAL_FLAGS are used during a rebuild
 AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
 
-# make libexecdir available for substituion in config files
-# 2 "evals" needed late to expand variable names.
-AC_SUBST([_libexecdir])
-AC_CONFIG_COMMANDS_PRE([eval eval _libexecdir=$libexecdir])
-
 # make _sysconfdir available for substituion in config files
 # 2 "evals" needed late to expand variable names.
 AC_SUBST([_sysconfdir])
@@ -530,7 +525,6 @@ AC_CONFIG_COMMANDS_PRE([eval eval _sysconfdir=$sysconfdir])
 
 AC_CONFIG_FILES([
 	Makefile
-	systemd/nfs-config.service
 	systemd/rpc-gssd.service
 	linux-nfs/Makefile
 	support/Makefile
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
index b647ef00a0d1..b5ab157d728b 100644
--- a/systemd/Makefile.am
+++ b/systemd/Makefile.am
@@ -5,7 +5,6 @@ MAINTAINERCLEANFILES = Makefile.in
 unit_files =  \
     nfs-client.target \
     \
-    nfs-config.service \
     nfs-mountd.service \
     nfs-server.service \
     nfs-utils.service \
diff --git a/systemd/README b/systemd/README
index 7c43df88438a..da23d6f63a91 100644
--- a/systemd/README
+++ b/systemd/README
@@ -19,8 +19,8 @@ by a suitable 'preset' setting:
     can work (if no type is given, ".service" is assumed).
 
  nfs-client.target
-    If enabled, daemons needs for an nfs client are enabled.
-    This does *not* include rpc.statd.  the rpc-statd.service unit
+    If enabled, daemons needed for an nfs client are enabled.
+    This does *not* include rpc.statd.  The rpc-statd.service unit
     is started by /usr/sbin/start-statd which mount.nfs will run
     if statd is needed.
 
@@ -52,11 +52,19 @@ It cannot stop rpc.statd or rpc.gssd as they may be in use by the
 client and systemd cannot specify is two-pronged reverse dependency.
 (i.e. stop this unit if none of these units are running)
 
-Distro specific commandline configuration can be provided by
-installing a script /usr/libexec/nfs-utils/nfs-utils_env.sh
-This should write /run/sysconfig/nfs-utils based on configuration
-information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.
-It is run once by nfs-config.service.
+Distro specific configuration can be included in /etc/nfs.conf, or
+by providing drop-in files which replace the ExecStart line for a given
+service, and possibly add an EnvironmentFile line.
+
+For example, if systemd/system/nfs-mountd.service.d/local.conf
+contained
+  [Service]
+  EnvironmentFile=/etc/sysconfig/nfs
+  ExecStart=
+  ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDOPTS
+
+then the setting of RPCMOUNTDOPTS in /etc/sysconfig/nfs would be
+passed to rpc.mountd.
 
 rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
 is present.
diff --git a/systemd/nfs-blkmap.service b/systemd/nfs-blkmap.service
index ddbf4e91da46..ddc324e70679 100644
--- a/systemd/nfs-blkmap.service
+++ b/systemd/nfs-blkmap.service
@@ -10,8 +10,7 @@ PartOf=nfs-utils.service
 [Service]
 Type=forking
 PIDFile=/var/run/blkmapd.pid
-EnvironmentFile=-/run/sysconfig/nfs-utils
-ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS
+ExecStart=/usr/sbin/blkmapd
 
 [Install]
 WantedBy=nfs-client.target
diff --git a/systemd/nfs-config.service.in b/systemd/nfs-config.service.in
deleted file mode 100644
index e89dc54209aa..000000000000
--- a/systemd/nfs-config.service.in
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
-Description=Preprocess NFS configuration
-After=local-fs.target
-DefaultDependencies=no
-
-[Service]
-Type=oneshot
-# This service needs to run any time any nfs service
-# is started, so changes to local config files get
-# incorporated.  Having "RemainAfterExit=no" (the default)
-# ensures this happens.
-RemainAfterExit=no
-ExecStart=@_libexecdir@/nfs-utils/nfs-utils_env.sh
diff --git a/systemd/nfs-idmapd.service b/systemd/nfs-idmapd.service
index df3dd9d8a856..acca86b683fb 100644
--- a/systemd/nfs-idmapd.service
+++ b/systemd/nfs-idmapd.service
@@ -6,10 +6,6 @@ After=var-lib-nfs-rpc_pipefs.mount local-fs.target
 
 BindsTo=nfs-server.service
 
-Wants=nfs-config.service
-After=nfs-config.service
-
 [Service]
-EnvironmentFile=-/run/sysconfig/nfs-utils
 Type=forking
-ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
+ExecStart=/usr/sbin/rpc.idmapd
diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
index 8a39f3e21184..15e828bc0d3c 100644
--- a/systemd/nfs-mountd.service
+++ b/systemd/nfs-mountd.service
@@ -6,10 +6,6 @@ After=proc-fs-nfsd.mount
 After=network.target local-fs.target
 BindsTo=nfs-server.service
 
-Wants=nfs-config.service
-After=nfs-config.service
-
 [Service]
-EnvironmentFile=-/run/sysconfig/nfs-utils
 Type=forking
-ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
+ExecStart=/usr/sbin/rpc.mountd
diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
index 196c81849ff4..5be5de65cf8a 100644
--- a/systemd/nfs-server.service
+++ b/systemd/nfs-server.service
@@ -16,16 +16,11 @@ Before= rpc-statd-notify.service
 Wants=auth-rpcgss-module.service
 After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
 
-Wants=nfs-config.service
-After=nfs-config.service
-
 [Service]
-EnvironmentFile=-/run/sysconfig/nfs-utils
-
 Type=oneshot
 RemainAfterExit=yes
 ExecStartPre=/usr/sbin/exportfs -r
-ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
+ExecStart=/usr/sbin/rpc.nfsd
 ExecStop=/usr/sbin/rpc.nfsd 0
 ExecStopPost=/usr/sbin/exportfs -au
 ExecStopPost=/usr/sbin/exportfs -f
diff --git a/systemd/rpc-gssd.service.in b/systemd/rpc-gssd.service.in
index 1a7911cb8f50..b35302740e37 100644
--- a/systemd/rpc-gssd.service.in
+++ b/systemd/rpc-gssd.service.in
@@ -9,11 +9,6 @@ ConditionPathExists=@_sysconfdir@/krb5.keytab
 
 PartOf=nfs-utils.service
 
-Wants=nfs-config.service
-After=nfs-config.service
-
 [Service]
-EnvironmentFile=-/run/sysconfig/nfs-utils
-
 Type=forking
-ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
+ExecStart=/usr/sbin/rpc.gssd
diff --git a/systemd/rpc-statd-notify.service b/systemd/rpc-statd-notify.service
index 89ba36cf6d61..7bfc9b16d782 100644
--- a/systemd/rpc-statd-notify.service
+++ b/systemd/rpc-statd-notify.service
@@ -10,10 +10,6 @@ After=nfs-server.service
 
 PartOf=nfs-utils.service
 
-Wants=nfs-config.service
-After=nfs-config.service
-
 [Service]
-EnvironmentFile=-/run/sysconfig/nfs-utils
 Type=forking
-ExecStart=-/usr/sbin/sm-notify $SMNOTIFYARGS
+ExecStart=-/usr/sbin/sm-notify
diff --git a/systemd/rpc-statd.service b/systemd/rpc-statd.service
index d5392b7cff4d..60d600f2fae6 100644
--- a/systemd/rpc-statd.service
+++ b/systemd/rpc-statd.service
@@ -7,12 +7,8 @@ After=network.target nss-lookup.target rpcbind.socket
 
 PartOf=nfs-utils.service
 
-Wants=nfs-config.service
-After=nfs-config.service
-
 [Service]
 Environment=RPC_STATD_NO_NOTIFY=1
-EnvironmentFile=-/run/sysconfig/nfs-utils
 Type=forking
 PIDFile=/var/run/rpc.statd.pid
-ExecStart=/usr/sbin/rpc.statd $STATDARGS
+ExecStart=/usr/sbin/rpc.statd
diff --git a/systemd/rpc-svcgssd.service b/systemd/rpc-svcgssd.service
index 41177b60d141..7187e3c35a41 100644
--- a/systemd/rpc-svcgssd.service
+++ b/systemd/rpc-svcgssd.service
@@ -11,10 +11,6 @@ ConditionPathExists=|!/run/gssproxy.pid
 ConditionPathExists=|!/proc/net/rpc/use-gss-proxy
 ConditionPathExists=/etc/krb5.keytab
 
-Wants=nfs-config.service
-After=nfs-config.service
-
 [Service]
-EnvironmentFile=-/run/sysconfig/nfs-utils
 Type=forking
-ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
+ExecStart=/usr/sbin/rpc.svcgssd



  parent reply	other threads:[~2016-12-02  4:00 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 ` [PATCH 04/15] Add /etc/nfs.conf support for mountd NeilBrown
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 11/15] conffile: ignore setting of empty string NeilBrown
2016-12-02  3:58 ` [PATCH 06/15] Add /etc/nfs.conf support for sm-notify 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 ` NeilBrown [this message]
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=148065111026.28046.13765788515171931087.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