]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Import Debian patch 1:1.2.8-9.1 debian/1%1.2.8-9.1
authorAndreas Henriksson <andreas@fatal.se>
Tue, 28 Jun 2016 00:05:16 +0000 (02:05 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 12 Dec 2016 19:55:45 +0000 (19:55 +0000)
18 files changed:
debian/changelog
debian/control
debian/nfs-common.install
debian/nfs-common.links
debian/nfs-kernel-server.install
debian/nfs-kernel-server.links
debian/nfs-utils_env.sh [new file with mode: 0644]
debian/patches/00git-start-statd-systemd.patch [new file with mode: 0644]
debian/patches/00git-systemd-units.patch [new file with mode: 0644]
debian/patches/23-systemd-relax-dependencies.patch [new file with mode: 0644]
debian/patches/24-systemd-pipefs_in_run.patch [new file with mode: 0644]
debian/patches/25-systemd-daemon-paths.patch [new file with mode: 0644]
debian/patches/26-systemd-server-before-client.patch [new file with mode: 0644]
debian/patches/27-systemd-enable-with-systemctl-statd.patch [new file with mode: 0644]
debian/patches/series
debian/rules
debian/tests/control [new file with mode: 0644]
debian/tests/local-server-client [new file with mode: 0644]

index c00a73597c0c8b4545b38272497b17e61de4fdf3..05a2ccea0f9b78e8c156211d51a8a801f9f486b6 100644 (file)
@@ -1,3 +1,67 @@
+nfs-utils (1:1.2.8-9.1) unstable; urgency=medium
+
+  Partial sync from ubuntu, included changes:
+
+  [ Martin Pitt ]
+  * Add 00git-start-statd-systemd.patch: Latest start-statd script from
+    1.3.2 to start rpc-statd.service under systemd.
+  * Add 23-systemd-pipefs_in_run.patch: systemd: Mount rpc_pipefs in /run instead of
+    /var/lib/nfs/, like in the upstart units.
+  * Add 24-systemd-daemon-paths.patch: Adjust program paths in systemd units.
+  * debian/nfs-kernel-server.links: Add nfs-kernel-server.service alias
+    symlink, to match SysV init script.
+  * Add 25-systemd-server-before-client.patch: Order NFS server before client,
+    to make mounting NFS shares from localhost work reliably.
+  * Add debian/nfs-utils_env.sh: Translate our /etc/default files into runtime
+    configuration for nfs-config.service.
+  * debian/nfs-{common,kernel-server}.install: Install systemd units.
+  * debian/rules: Enable/start systemd units. (LP: #1312976)
+
+  * Add autopkgtest for installing server and client on localhost, setting up
+    two exports, rebooting, and ensuring that the NFS mounts work.
+  * Add 23-systemd-relax-dependencies.patch: Stop depending on basic.target in
+    the daemons which still do; i. e. add DefaultDependencies=no. This makes
+    it possible to run NFS during early boot, helps if you e. g. have /var
+    on NFS, and avoids dependency cycles with rcS init.d scripts which depend
+    on $remote_fs. (LP: #1428487)
+  * Shift number prefixes of other systemd patches accordingly, and adjust
+    them to the above patch.
+
+  * 27-systemd-enable-with-systemctl-statd.patch: let the admin
+    enable/disable statd via systemd tools. (LP: #1428486)
+  * debian/rules: don't start statd by default (or it will trigger upstart
+    and systemd statd unit startup).
+  * debian/control, debian/*install: move nfs-utils.service to nfs-common
+    package. (LP: #1436304)
+
+  [ Steve Langasek ]
+  * Add a dependency on keyutils to nfs-common, so that idmapping will work
+    under systemd.  LP: #1449074.
+
+  Followup changes to complement merge from ubuntu:
+
+  [ Andreas Henriksson ]
+  * Restore anything related to nfs-common.init and nfs-common.default
+  * debian/nfs-common.links: Mask nfs-common init script with a symlink
+    to /dev/null to avoid using it under systemd.
+  * Explicitly set executable permissions on nfs-utils_env.sh helper
+    instead of relying on debian/nfs-utils_env.sh having correct
+    permissions in source directory.
+
+  All of the above Closes: #796637
+
+  Additional changes while at it:
+
+  [ Andreas Henriksson ]
+  * Make nfs-kernel-server depend on netbase since it needs /etc/services
+    for nfs-server to start (which is required for successful pkg install).
+    - Avoids "...unable to resolve ANYADDR:nfs to inet address: ..."
+
+  [ Martin Pitt ]
+  * Drop obsolete versioned initscripts dependency. (Closes: #804990)
+
+ -- Andreas Henriksson <andreas@fatal.se>  Tue, 28 Jun 2016 02:05:16 +0200
+
 nfs-utils (1:1.2.8-9) unstable; urgency=medium
 
   * debian/patches/22-mountd-fix-segfault-in-add_name-with-newer-gcc-
index 51b1a11af825939a6d883c38012e915cda28b0dc..f98ea5d2e753524c46f70b614837e8845b8d6bd2 100644 (file)
@@ -3,7 +3,7 @@ Priority: standard
 Section: net
 Maintainer: Debian kernel team <debian-kernel@lists.debian.org>
 Uploaders: Anibal Monsalve Salazar <anibal@debian.org>, Ben Hutchings <ben@decadent.org.uk>, Steve Langasek <vorlon@debian.org>
-Build-Depends: debhelper (>= 7), libwrap0-dev, libevent-dev, libnfsidmap-dev (>= 0.24), libkrb5-dev, libblkid-dev, libkeyutils-dev, pkg-config, libldap2-dev, libcap-dev, libtirpc-dev (>= 0.2.4-2~), libdevmapper-dev, dh-autoreconf, libmount-dev, libsqlite3-dev
+Build-Depends: debhelper (>= 7), libwrap0-dev, libevent-dev, libnfsidmap-dev (>= 0.24), libkrb5-dev, libblkid-dev, libkeyutils-dev, pkg-config, libldap2-dev, libcap-dev, libtirpc-dev (>= 0.2.4-2~), libdevmapper-dev, dh-autoreconf, libmount-dev, libsqlite3-dev, dh-systemd
 Standards-Version: 3.9.0
 Homepage: http://nfs.sourceforge.net/
 Vcs-Git: git://git.debian.org/kernel/nfs-utils.git
@@ -12,7 +12,7 @@ Vcs-Browser: http://git.debian.org/?p=kernel/nfs-utils.git
 Package: nfs-kernel-server
 Priority: optional
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, nfs-common (= ${binary:Version}), ucf, lsb-base (>= 1.3-9ubuntu3), libtirpc1 (>= 0.2.4)
+Depends: ${shlibs:Depends}, ${misc:Depends}, nfs-common (= ${binary:Version}), ucf, netbase, lsb-base (>= 1.3-9ubuntu3), libtirpc1 (>= 0.2.4), keyutils
 Provides: knfs, nfs-server
 Conflicts: knfs, nfs-server
 Replaces: knfs, nfs-server
@@ -32,7 +32,7 @@ Homepage: http://nfs.sourceforge.net/
 
 Package: nfs-common
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, rpcbind, adduser, ucf, lsb-base (>= 1.3-9ubuntu3), initscripts (>= 2.88dsf-13.3), libtirpc1 (>= 0.2.4)
+Depends: ${shlibs:Depends}, ${misc:Depends}, rpcbind, adduser, ucf, lsb-base (>= 1.3-9ubuntu3), libtirpc1 (>= 0.2.4)
 Recommends: python
 Suggests: open-iscsi, watchdog
 Provides: nfs-client
index d19454099fc0444e0807503a79a52945aa2eef54..75e2112c62e665035ca5c8dc4485e26350d44719 100644 (file)
@@ -22,3 +22,10 @@ debian/tmp/var/lib/nfs/state
 debian/idmapd.conf usr/share/nfs-common/conffiles/
 debian/nfs-common.default usr/share/nfs-common/conffiles/
 debian/id_resolver.conf etc/request-key.d/
+debian/nfs-utils_env.sh /usr/lib/systemd/scripts/
+systemd/*.mount /lib/systemd/system
+systemd/*rpc*.service /lib/systemd/system
+systemd/nfs-config.service /lib/systemd/system
+systemd/nfs-idmapd.service /lib/systemd/system
+systemd/nfs-client.target /lib/systemd/system
+systemd/nfs-utils.service /lib/systemd/system
index d84465d021cb39acbd9add2df2f193af08b99b7c..bbd322757b257f403296b4a7c7b030b3f19fc141 100644 (file)
@@ -3,3 +3,4 @@ usr/share/man/man8/statd.8 usr/share/man/man8/rpc.statd.8
 usr/share/man/man8/idmapd.8 usr/share/man/man8/rpc.idmapd.8
 usr/share/man/man8/sm-notify.8 usr/share/man/man8/rpc.sm-notify.8
 usr/share/man/man8/svcgssd.8 usr/share/man/man8/rpc.svcgssd.8
+/dev/null /lib/systemd/system/nfs-common.service
index 7359d3494ad3c1c7cca4d5afd192e8a75586b3d3..4773a652f7a3fcb863a12de6740c74d51aac24e6 100644 (file)
@@ -7,3 +7,7 @@ debian/tmp/var/lib/nfs/etab
 debian/tmp/var/lib/nfs/rmtab
 debian/nfs-kernel-server.default /usr/share/nfs-kernel-server/conffiles/
 debian/etc.exports /usr/share/nfs-kernel-server/conffiles/
+systemd/nfs-blkmap.target /lib/systemd/system
+systemd/nfs-blkmap.service /lib/systemd/system
+systemd/nfs-mountd.service /lib/systemd/system
+systemd/nfs-server.service /lib/systemd/system
index 94322c20eba89200ef19b2e92750e0f1630e2892..58ea738f20fc55a1aab52238e023032bfd792b88 100644 (file)
@@ -1,2 +1,4 @@
 usr/share/man/man8/mountd.8 usr/share/man/man8/rpc.mountd.8
 usr/share/man/man8/nfsd.8 usr/share/man/man8/rpc.nfsd.8
+# provide match for SysV init script
+/lib/systemd/system/nfs-server.service /lib/systemd/system/nfs-kernel-server.service
diff --git a/debian/nfs-utils_env.sh b/debian/nfs-utils_env.sh
new file mode 100644 (file)
index 0000000..d48eb51
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Create /run/sysconfig/nfs-utils from NFS' /etc/default/ files, for
+# nfs-config.service
+
+nfs_config=/etc/sysconfig/nfs
+[ -r /etc/default/nfs-common ] && . /etc/default/nfs-common
+[ -r /etc/default/nfs-kernel-server ] && . /etc/default/nfs-kernel-server
+
+mkdir -p /run/sysconfig
+{
+echo PIPEFS_MOUNTPOINT=/run/rpc_pipefs
+echo RPCNFSDARGS=\"$RPCNFSDOPTS ${RPCNFSDCOUNT:-8}\"
+echo RPCMOUNTDARGS=\"$RPCMOUNTDOPTS\"
+echo STATDARGS=\"$STATDOPTS\"
+echo RPCSVCGSSDARGS=\"$RPCSVCGSSDOPTS\"
+} > /run/sysconfig/nfs-utils
+
+# the following are supported by the systemd units, but not exposed in default files
+# echo SMNOTIFYARGS=\"$SMNOTIFYARGS\"
+# echo RPCIDMAPDARGS=\"$RPCIDMAPDARGS\"
+# echo RPCGSSDARGS=\"$RPCGSSDARGS\"
+# echo BLKMAPDARGS=\"$BLKMAPDARGS\"
+# echo GSS_USE_PROXY=\"$GSS_USE_PROXY\"
diff --git a/debian/patches/00git-start-statd-systemd.patch b/debian/patches/00git-start-statd-systemd.patch
new file mode 100644 (file)
index 0000000..6da8857
--- /dev/null
@@ -0,0 +1,27 @@
+Description: Latest start-statd script from 1.3.2 to start rpc-statd.service under systemd
+Origin: upstream, from 1.3.2
+
+Index: nfs-utils-1.2.8/utils/statd/start-statd
+===================================================================
+--- nfs-utils-1.2.8.orig/utils/statd/start-statd
++++ nfs-utils-1.2.8/utils/statd/start-statd
+@@ -1,9 +1,16 @@
+-#!/bin/bash -p
++#!/bin/sh
+ # nfsmount calls this script when mounting a filesystem with locking
+ # enabled, but when statd does not seem to be running (based on
+ # /var/run/rpc.statd.pid).
+ # It should run statd with whatever flags are apropriate for this
+ # site.
+-PATH=/sbin:/usr/sbin
+-exec rpc.statd --no-notify
++PATH="/sbin:/usr/sbin:/bin:/usr/bin"
++
++# First try systemd if it's installed.
++if [ -d /run/systemd/system ]; then
++    # Quit only if the call worked.
++    systemctl start rpc-statd.service && exit
++fi
++# Fall back to launching it ourselves.
++exec rpc.statd --no-notify
diff --git a/debian/patches/00git-systemd-units.patch b/debian/patches/00git-systemd-units.patch
new file mode 100644 (file)
index 0000000..dea2b14
--- /dev/null
@@ -0,0 +1,385 @@
+Description: systemd units from upstream
+Origin: upstream, 1.3.2
+
+Index: nfs-utils-1.2.8/systemd/README
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/README
+@@ -0,0 +1,71 @@
++
++Notes about systemd unit files for nfs-utils.
++
++The unit files provided here should be sufficient for systemd
++to manage all daemons and related services provides by nfs-utils.
++
++They do *not* include any unit files for separate services such as
++rpc.rquotad (in the 'quota' package) or rpcbind.
++
++There are 4 units that can be 'enabled' or 'disabled' by systemctl, or
++by a suitable 'preset' setting:
++
++ nfs-server.service
++    If enabled, nfs service is started together with dependencies
++    such as mountd, statd, rpc.idmapd
++    This is a "service" file rather than a "target" (which is the
++    normal grouping construct) so that
++        systemctl start nfs-server
++    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
++    is started by /usr/sbin/start-statd which mount.nfs will run
++    if statd is needed.
++
++ nfs-blkmap.target
++    If enabled, then blkmapd will be run when nfs-client.target is
++    started.
++
++Another special unit is "nfs-utils.service".  This doesn't really do
++anything, but exists so that other units may declare themselves as
++"PartOf" nfs-utils.service.
++The effect of this is that
++     systemctl restart nfs-utils
++will restart all nfs-utils daemons as maybe be required during
++software update.  It isn't possible to make
++     systemctl try-restart nfs-server nfs-client.target
++do this as some daemon are included in both, and rpc.statd would
++not be restarted if nfs-server were not active (as nfs-client doesn't
++Want it - it is started by mount.nfs running start-statd).
++
++It is possible that we should have an nfs-statd.target which can
++selectively enable statd being stared by -server and sm-notify
++being started by -server or -client.  That way it could be disabled
++completely on V4-only configurations.  Currently statd is always
++started on the server and sm-notify is always run if server or
++client is enabled.
++
++Stopping nfs-server will also stop rpc.mountd, and rpc.svcgssd.
++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/lib/systemd/scripts/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.
++
++rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
++is present.
++If a site needs this file present but does not want the gss daemons
++running, it should create
++   /etc/systemd/system/rpc-gssd.service.d/01-disable.conf
++and
++   /etc/systemd/system/rpc-svcgssd.service.d/01-disable.conf
++
++containing
++   [Unit]
++   ConditionNull=false
+Index: nfs-utils-1.2.8/systemd/auth-rpcgss-module.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/auth-rpcgss-module.service
+@@ -0,0 +1,15 @@
++# We want to start gss-proxy on kernels that support it and rpc.svcgssd
++# on those that don't.  Those services check for support by checking
++# for existence of the path /proc/net/rpc/use-gss-proxy.  Before they
++# can perform that check, they need this module loaded.  (Unless
++# rpcsec_gss support is built directly into the kernel, in which case this
++# unit will fail.  But that's OK.)
++[Unit]
++Description=Kernel Module supporting RPCSEC_GSS
++Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
++Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
++ConditionPathExists=/etc/krb5.keytab
++
++[Service]
++Type=oneshot
++ExecStart=/sbin/modprobe -q auth_rpcgss
+Index: nfs-utils-1.2.8/systemd/nfs-blkmap.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/nfs-blkmap.service
+@@ -0,0 +1,16 @@
++[Unit]
++Description=pNFS block layout mapping daemon
++DefaultDependencies=no
++Conflicts=umount.target
++After=var-lib-nfs-rpc_pipefs.mount
++Requires=var-lib-nfs-rpc_pipefs.mount
++
++Requisite=nfs-blkmap.target
++After=nfs-blkmap.target
++
++PartOf=nfs-utils.service
++
++[Service]
++Type=forking
++PIDFile=/var/run/blkmapd.pid
++ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS
+Index: nfs-utils-1.2.8/systemd/nfs-blkmap.target
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/nfs-blkmap.target
+@@ -0,0 +1,8 @@
++[Unit]
++Description= PNFS blkmaping enablement.
++# If this target is enabled, then blkmapd will be started
++# as required.  If it is not enabled it won't.
++
++[Install]
++WantedBy=remote-fs.target
++WantedBy=multi-user.target
+\ No newline at end of file
+Index: nfs-utils-1.2.8/systemd/nfs-client.target
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/nfs-client.target
+@@ -0,0 +1,17 @@
++[Unit]
++Description=NFS client services
++Before=remote-fs-pre.target
++Wants=remote-fs-pre.target
++
++# Note: we don't "Wants=rpc-statd.service" as "mount.nfs" will arrange to
++# start that on demand if needed.
++Wants=nfs-blkmap.service rpc-statd-notify.service
++After=nfs-blkmap.service
++
++# GSS services dependencies and ordering
++Wants=auth-rpcgss-module.service
++After=rpc-gssd.service rpc-svcgssd.service gssproxy.service
++
++[Install]
++WantedBy=multi-user.target
++WantedBy=remote-fs.target
+Index: nfs-utils-1.2.8/systemd/nfs-config.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/nfs-config.service
+@@ -0,0 +1,7 @@
++[Unit]
++Description=Preprocess NFS configuration
++
++[Service]
++Type=oneshot
++RemainAfterExit=yes
++ExecStart=/usr/lib/systemd/scripts/nfs-utils_env.sh
+Index: nfs-utils-1.2.8/systemd/nfs-idmapd.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/nfs-idmapd.service
+@@ -0,0 +1,14 @@
++[Unit]
++Description=NFSv4 ID-name mapping service
++Requires=var-lib-nfs-rpc_pipefs.mount
++After=var-lib-nfs-rpc_pipefs.mount
++
++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
+Index: nfs-utils-1.2.8/systemd/nfs-mountd.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/nfs-mountd.service
+@@ -0,0 +1,14 @@
++[Unit]
++Description=NFS Mount Daemon
++Requires=proc-fs-nfsd.mount
++After=proc-fs-nfsd.mount
++After=network.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
+Index: nfs-utils-1.2.8/systemd/nfs-server.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/nfs-server.service
+@@ -0,0 +1,33 @@
++[Unit]
++Description=NFS server and services
++Requires= network.target proc-fs-nfsd.mount rpcbind.target
++Requires= nfs-mountd.service
++Wants=rpc-statd.service nfs-idmapd.service
++Wants=rpc-statd-notify.service
++
++After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
++After= nfs-idmapd.service rpc-statd.service
++Before= rpc-statd-notify.service
++
++# GSS services dependencies and ordering
++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
++ExecStop=/usr/sbin/rpc.nfsd 0
++ExecStopPost=/usr/sbin/exportfs -au
++ExecStopPost=/usr/sbin/exportfs -f
++
++ExecReload=/usr/sbin/exportfs -r
++
++[Install]
++WantedBy=multi-user.target
+Index: nfs-utils-1.2.8/systemd/nfs-utils.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/nfs-utils.service
+@@ -0,0 +1,17 @@
++[Unit]
++Description=NFS server and client services
++# This service should never be stopped, only restarted.
++# When it is re-started, all other services which declare
++# themselves to be "PartOf" this service will also be
++# restarted. Thus
++#   systemctl restart nfs-utils
++# will restart all daemons which are part of nfs-utils
++# and which are running.  This is useful after a software
++# update.
++
++# This is a "service" rather than "target" so that we
++# don't need to say "systemctl restart nfs-utils.target".
++[Service]
++Type=oneshot
++RemainAfterExit=yes
++ExecStart=/bin/true
+Index: nfs-utils-1.2.8/systemd/proc-fs-nfsd.mount
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/proc-fs-nfsd.mount
+@@ -0,0 +1,7 @@
++[Unit]
++Description=NFSD configuration filesystem
++
++[Mount]
++What=nfsd
++Where=/proc/fs/nfsd
++Type=nfsd
+Index: nfs-utils-1.2.8/systemd/rpc-gssd.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/rpc-gssd.service
+@@ -0,0 +1,19 @@
++[Unit]
++Description=RPC security service for NFS client and server
++DefaultDependencies=no
++Conflicts=umount.target
++Requires=var-lib-nfs-rpc_pipefs.mount
++After=var-lib-nfs-rpc_pipefs.mount
++
++ConditionPathExists=/etc/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
+Index: nfs-utils-1.2.8/systemd/rpc-statd-notify.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/rpc-statd-notify.service
+@@ -0,0 +1,18 @@
++[Unit]
++Description=Notify NFS peers of a restart
++Requires=network-online.target
++After=network.target nss-lookup.target
++
++# if we run an nfs server, it needs to be running before we
++# tell clients that it has restarted.
++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
+Index: nfs-utils-1.2.8/systemd/rpc-statd.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/rpc-statd.service
+@@ -0,0 +1,17 @@
++[Unit]
++Description=NFS status monitor for NFSv2/3 locking.
++DefaultDependencies=no
++Conflicts=umount.target
++Requires=nss-lookup.target rpcbind.target
++After=network.target nss-lookup.target rpcbind.target
++
++PartOf=nfs-utils.service
++
++Wants=nfs-config.service
++After=nfs-config.service
++
++[Service]
++EnvironmentFile=-/run/sysconfig/nfs-utils
++Type=forking
++PIDFile=/var/run/rpc.statd.pid
++ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
+Index: nfs-utils-1.2.8/systemd/rpc-svcgssd.service
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/rpc-svcgssd.service
+@@ -0,0 +1,19 @@
++[Unit]
++Description=RPC security service for NFS server
++Requires=var-lib-nfs-rpc_pipefs.mount
++After=var-lib-nfs-rpc_pipefs.mount
++PartOf=nfs-server.service
++PartOf=nfs-utils.service
++
++After=gssproxy.service
++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
+Index: nfs-utils-1.2.8/systemd/var-lib-nfs-rpc_pipefs.mount
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/var-lib-nfs-rpc_pipefs.mount
+@@ -0,0 +1,9 @@
++[Unit]
++Description=RPC Pipe File System
++DefaultDependencies=no
++Conflicts=umount.target
++
++[Mount]
++What=sunrpc
++Where=/var/lib/nfs/rpc_pipefs
++Type=rpc_pipefs
diff --git a/debian/patches/23-systemd-relax-dependencies.patch b/debian/patches/23-systemd-relax-dependencies.patch
new file mode 100644 (file)
index 0000000..b397cce
--- /dev/null
@@ -0,0 +1,122 @@
+From 314a5003a27d2a654d117c40714739e6aa3b7092 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt@ubuntu.com>
+Date: Tue, 3 Mar 2015 16:42:28 +0100
+Subject: [PATCH] systemd: Relax dependencies of services
+
+Stop depending on basic.target in the daemons which still do; i. e. add
+DefaultDependencies=no. This makes it possible to run NFS during early boot,
+and helps if you e. g. have /var on NFS. We don't require much else than
+local-fs.
+---
+ systemd/auth-rpcgss-module.service | 1 +
+ systemd/nfs-config.service         | 2 ++
+ systemd/nfs-idmapd.service         | 3 ++-
+ systemd/nfs-mountd.service         | 3 ++-
+ systemd/nfs-server.service         | 2 ++
+ systemd/rpc-statd-notify.service   | 3 ++-
+ systemd/rpc-svcgssd.service        | 3 ++-
+ 7 files changed, 13 insertions(+), 4 deletions(-)
+
+Forwarded: http://www.spinics.net/lists/linux-nfs/msg49934.html
+
+diff --git a/systemd/auth-rpcgss-module.service b/systemd/auth-rpcgss-module.service
+index 0355e13..5241f7b 100644
+--- a/systemd/auth-rpcgss-module.service
++++ b/systemd/auth-rpcgss-module.service
+@@ -6,6 +6,7 @@
+ # unit will fail.  But that's OK.)
+ [Unit]
+ Description=Kernel Module supporting RPCSEC_GSS
++DefaultDependencies=no
+ Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
+ Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
+ ConditionPathExists=/etc/krb5.keytab
+diff --git a/systemd/nfs-config.service b/systemd/nfs-config.service
+index 64010e6..7f65305 100644
+--- a/systemd/nfs-config.service
++++ b/systemd/nfs-config.service
+@@ -1,5 +1,7 @@
+ [Unit]
+ Description=Preprocess NFS configuration
++After=local-fs.target
++DefaultDependencies=no
+ [Service]
+ Type=oneshot
+diff --git a/systemd/nfs-idmapd.service b/systemd/nfs-idmapd.service
+index e84f8c8..df3dd9d 100644
+--- a/systemd/nfs-idmapd.service
++++ b/systemd/nfs-idmapd.service
+@@ -1,7 +1,8 @@
+ [Unit]
+ Description=NFSv4 ID-name mapping service
++DefaultDependencies=no
+ Requires=var-lib-nfs-rpc_pipefs.mount
+-After=var-lib-nfs-rpc_pipefs.mount
++After=var-lib-nfs-rpc_pipefs.mount local-fs.target
+ BindsTo=nfs-server.service
+diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
+index d908afe..8a39f3e 100644
+--- a/systemd/nfs-mountd.service
++++ b/systemd/nfs-mountd.service
+@@ -1,8 +1,9 @@
+ [Unit]
+ Description=NFS Mount Daemon
++DefaultDependencies=no
+ Requires=proc-fs-nfsd.mount
+ After=proc-fs-nfsd.mount
+-After=network.target
++After=network.target local-fs.target
+ BindsTo=nfs-server.service
+ Wants=nfs-config.service
+diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
+index b35e193..db801cb 100644
+--- a/systemd/nfs-server.service
++++ b/systemd/nfs-server.service
+@@ -1,10 +1,12 @@
+ [Unit]
+ Description=NFS server and services
++DefaultDependencies=no
+ Requires= network.target proc-fs-nfsd.mount rpcbind.target
+ Requires= nfs-mountd.service
+ Wants=rpc-statd.service nfs-idmapd.service
+ Wants=rpc-statd-notify.service
++After= local-fs.target
+ After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
+ After= nfs-idmapd.service rpc-statd.service
+ Before= rpc-statd-notify.service
+diff --git a/systemd/rpc-statd-notify.service b/systemd/rpc-statd-notify.service
+index a655445..a7e2f8e 100644
+--- a/systemd/rpc-statd-notify.service
++++ b/systemd/rpc-statd-notify.service
+@@ -1,7 +1,8 @@
+ [Unit]
+ Description=Notify NFS peers of a restart
++DefaultDependencies=no
+ Requires=network-online.target
+-After=network.target nss-lookup.target
++After=local-fs.target network.target nss-lookup.target
+ # if we run an nfs server, it needs to be running before we
+ # tell clients that it has restarted.
+diff --git a/systemd/rpc-svcgssd.service b/systemd/rpc-svcgssd.service
+index f7424b0..41177b6 100644
+--- a/systemd/rpc-svcgssd.service
++++ b/systemd/rpc-svcgssd.service
+@@ -1,7 +1,8 @@
+ [Unit]
+ Description=RPC security service for NFS server
++DefaultDependencies=no
+ Requires=var-lib-nfs-rpc_pipefs.mount
+-After=var-lib-nfs-rpc_pipefs.mount
++After=var-lib-nfs-rpc_pipefs.mount local-fs.target
+ PartOf=nfs-server.service
+ PartOf=nfs-utils.service
+-- 
+2.1.4
+
diff --git a/debian/patches/24-systemd-pipefs_in_run.patch b/debian/patches/24-systemd-pipefs_in_run.patch
new file mode 100644 (file)
index 0000000..4e312a1
--- /dev/null
@@ -0,0 +1,92 @@
+Description: systemd: Mount rpc_pipefs in /run instead of /var/lib/nfs/
+Author: Martin Pitt <martin.pitt@ubuntu.com>
+Forwarded: No
+
+Index: nfs-utils-1.2.8/systemd/var-lib-nfs-rpc_pipefs.mount
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/var-lib-nfs-rpc_pipefs.mount
++++ /dev/null
+@@ -1,9 +0,0 @@
+-[Unit]
+-Description=RPC Pipe File System
+-DefaultDependencies=no
+-Conflicts=umount.target
+-
+-[Mount]
+-What=sunrpc
+-Where=/var/lib/nfs/rpc_pipefs
+-Type=rpc_pipefs
+Index: nfs-utils-1.2.8/systemd/nfs-blkmap.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/nfs-blkmap.service
++++ nfs-utils-1.2.8/systemd/nfs-blkmap.service
+@@ -2,8 +2,8 @@
+ Description=pNFS block layout mapping daemon
+ DefaultDependencies=no
+ Conflicts=umount.target
+-After=var-lib-nfs-rpc_pipefs.mount
+-Requires=var-lib-nfs-rpc_pipefs.mount
++After=run-rpc_pipefs.mount
++Requires=run-rpc_pipefs.mount
+ Requisite=nfs-blkmap.target
+ After=nfs-blkmap.target
+Index: nfs-utils-1.2.8/systemd/nfs-idmapd.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/nfs-idmapd.service
++++ nfs-utils-1.2.8/systemd/nfs-idmapd.service
+@@ -1,8 +1,8 @@
+ [Unit]
+ Description=NFSv4 ID-name mapping service
+ DefaultDependencies=no
+-Requires=var-lib-nfs-rpc_pipefs.mount
+-After=var-lib-nfs-rpc_pipefs.mount local-fs.target
++Requires=run-rpc_pipefs.mount
++After=run-rpc_pipefs.mount local-fs.target
+ BindsTo=nfs-server.service
+Index: nfs-utils-1.2.8/systemd/rpc-gssd.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/rpc-gssd.service
++++ nfs-utils-1.2.8/systemd/rpc-gssd.service
+@@ -2,8 +2,8 @@
+ Description=RPC security service for NFS client and server
+ DefaultDependencies=no
+ Conflicts=umount.target
+-Requires=var-lib-nfs-rpc_pipefs.mount
+-After=var-lib-nfs-rpc_pipefs.mount
++Requires=run-rpc_pipefs.mount
++After=run-rpc_pipefs.mount
+ ConditionPathExists=/etc/krb5.keytab
+Index: nfs-utils-1.2.8/systemd/rpc-svcgssd.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/rpc-svcgssd.service
++++ nfs-utils-1.2.8/systemd/rpc-svcgssd.service
+@@ -1,8 +1,8 @@
+ [Unit]
+ Description=RPC security service for NFS server
+ DefaultDependencies=no
+-Requires=var-lib-nfs-rpc_pipefs.mount
+-After=var-lib-nfs-rpc_pipefs.mount local-fs.target
++Requires=run-rpc_pipefs.mount
++After=run-rpc_pipefs.mount local-fs.target
+ PartOf=nfs-server.service
+ PartOf=nfs-utils.service
+Index: nfs-utils-1.2.8/systemd/run-rpc_pipefs.mount
+===================================================================
+--- /dev/null
++++ nfs-utils-1.2.8/systemd/run-rpc_pipefs.mount
+@@ -0,0 +1,9 @@
++[Unit]
++Description=RPC Pipe File System
++DefaultDependencies=no
++Conflicts=umount.target
++
++[Mount]
++What=sunrpc
++Where=/run/rpc_pipefs
++Type=rpc_pipefs
diff --git a/debian/patches/25-systemd-daemon-paths.patch b/debian/patches/25-systemd-daemon-paths.patch
new file mode 100644 (file)
index 0000000..d9f3b99
--- /dev/null
@@ -0,0 +1,24 @@
+Description: Adjust program paths in systemd units
+Author: Martin Pitt <martin.pitt@ubuntu.com>
+Forwarded: No
+
+Index: nfs-utils-1.2.8/systemd/rpc-statd-notify.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/rpc-statd-notify.service
++++ nfs-utils-1.2.8/systemd/rpc-statd-notify.service
+@@ -16,4 +16,4 @@ After=nfs-config.service
+ [Service]
+ EnvironmentFile=-/run/sysconfig/nfs-utils
+ Type=forking
+-ExecStart=-/usr/sbin/sm-notify $SMNOTIFYARGS
++ExecStart=-/sbin/sm-notify $SMNOTIFYARGS
+Index: nfs-utils-1.2.8/systemd/rpc-statd.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/rpc-statd.service
++++ nfs-utils-1.2.8/systemd/rpc-statd.service
+@@ -14,4 +14,4 @@ After=nfs-config.service
+ EnvironmentFile=-/run/sysconfig/nfs-utils
+ Type=forking
+ PIDFile=/var/run/rpc.statd.pid
+-ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
++ExecStart=/sbin/rpc.statd --no-notify $STATDARGS
diff --git a/debian/patches/26-systemd-server-before-client.patch b/debian/patches/26-systemd-server-before-client.patch
new file mode 100644 (file)
index 0000000..bec4b8e
--- /dev/null
@@ -0,0 +1,28 @@
+From d8c1fcce6d06aa062315a47134e8e3b364cb0700 Mon Sep 17 00:00:00 2001
+From: Martin Pitt <martin.pitt@ubuntu.com>
+Date: Tue, 3 Mar 2015 10:45:38 +0100
+Subject: [PATCH] systemd: Order NFS server before client
+
+This makes mounting NFS shares from localhost work reliably, as you need to
+start the server before attempting (client) mounts, and conversely on shutdown
+need to unmount all shares before stopping the server to avoid hangs.
+---
+ systemd/nfs-server.service | 3 +++
+ 1 file changed, 3 insertions(+)
+
+Forwarded: http://www.spinics.net/lists/linux-nfs/msg49934.html
+
+Index: nfs-utils-1.2.8/systemd/nfs-server.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/nfs-server.service
++++ nfs-utils-1.2.8/systemd/nfs-server.service
+@@ -15,6 +15,9 @@ Before= rpc-statd-notify.service
+ Wants=auth-rpcgss-module.service
+ After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
++# start/stop server before/after client
++Before=remote-fs-pre.target
++
+ Wants=nfs-config.service
+ After=nfs-config.service
diff --git a/debian/patches/27-systemd-enable-with-systemctl-statd.patch b/debian/patches/27-systemd-enable-with-systemctl-statd.patch
new file mode 100644 (file)
index 0000000..1b0497a
--- /dev/null
@@ -0,0 +1,66 @@
+Description: Let sysadmins enable/disable statd services
+ As the admin was able to control under upstart the statd services with
+ NEED_STATD in default conffiles, mirror this funcationality under systemd
+ by letting the user systemctl enable/disable statd services.
+Author: Didier Roche <didrocks@ubuntu.com>
+Bug-Ubuntu: https://launchpad.net/bugs/1428486
+Index: nfs-utils-1.2.8/systemd/nfs-server.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/nfs-server.service
++++ nfs-utils-1.2.8/systemd/nfs-server.service
+@@ -3,8 +3,7 @@ Description=NFS server and services
+ DefaultDependencies=no
+ Requires= network.target proc-fs-nfsd.mount rpcbind.target
+ Requires= nfs-mountd.service
+-Wants=rpc-statd.service nfs-idmapd.service
+-Wants=rpc-statd-notify.service
++Wants=nfs-idmapd.service
+ After= local-fs.target
+ After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
+Index: nfs-utils-1.2.8/systemd/rpc-statd-notify.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/rpc-statd-notify.service
++++ nfs-utils-1.2.8/systemd/rpc-statd-notify.service
+@@ -17,3 +17,6 @@ After=nfs-config.service
+ EnvironmentFile=-/run/sysconfig/nfs-utils
+ Type=forking
+ ExecStart=-/sbin/sm-notify $SMNOTIFYARGS
++
++[Install]
++WantedBy=nfs-client.target
+Index: nfs-utils-1.2.8/systemd/rpc-statd.service
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/rpc-statd.service
++++ nfs-utils-1.2.8/systemd/rpc-statd.service
+@@ -7,7 +7,7 @@ After=network.target nss-lookup.target r
+ PartOf=nfs-utils.service
+-Wants=nfs-config.service
++Wants=nfs-config.service rpc-statd-notify.service
+ After=nfs-config.service
+ [Service]
+@@ -15,3 +15,6 @@ EnvironmentFile=-/run/sysconfig/nfs-util
+ Type=forking
+ PIDFile=/var/run/rpc.statd.pid
+ ExecStart=/sbin/rpc.statd --no-notify $STATDARGS
++
++[Install]
++WantedBy=nfs-server.service
+Index: nfs-utils-1.2.8/systemd/nfs-client.target
+===================================================================
+--- nfs-utils-1.2.8.orig/systemd/nfs-client.target
++++ nfs-utils-1.2.8/systemd/nfs-client.target
+@@ -3,9 +3,7 @@ Description=NFS client services
+ Before=remote-fs-pre.target
+ Wants=remote-fs-pre.target
+-# Note: we don't "Wants=rpc-statd.service" as "mount.nfs" will arrange to
+-# start that on demand if needed.
+-Wants=nfs-blkmap.service rpc-statd-notify.service
++Wants=nfs-blkmap.service
+ After=nfs-blkmap.service
+ # GSS services dependencies and ordering
index 8c74c7851901c816ee8a79054eb1093c429a1ab4..2211877a44c676617e363257cd713b7de2c72017 100644 (file)
@@ -1,3 +1,5 @@
+00git-start-statd-systemd.patch
+00git-systemd-units.patch
 21-no-more-var-run.patch
 01-sm-notify-in-sbin.patch
 02-524255-manpages.patch
@@ -8,3 +10,8 @@
 19-iscsiadm-path.patch
 20-remove-autogenerated-man.patch
 22-mountd-fix-segfault-in-add_name-with-newer-gcc-compi.patch 
+23-systemd-relax-dependencies.patch
+24-systemd-pipefs_in_run.patch
+25-systemd-daemon-paths.patch
+26-systemd-server-before-client.patch
+27-systemd-enable-with-systemctl-statd.patch
index 5cff5ce2a0e59f66afb6d3230939b6a44be17085..215401dd15dd5f6e95fdef72eab9c7df1ae279f8 100755 (executable)
@@ -54,7 +54,11 @@ binary-arch: build
        dh_install -Xman --fail-missing
        dh_installdocs -A
        dh_installdocs -pnfs-common debian/README.Debian.nfsv4
+       dh_systemd_enable -p nfs-common nfs-client.target
+       dh_systemd_enable -p nfs-kernel-server nfs-server.service
        dh_installinit -pnfs-common -R
+       dh_systemd_start -p nfs-common --restart-after-upgrade nfs-utils.service
+       dh_systemd_start -p nfs-kernel-server --restart-after-upgrade nfs-server.service
        install -m 0755 debian/nfs-kernel-server.init debian/nfs-kernel-server/etc/init.d/nfs-kernel-server
        install -m 0644 debian/nfs-common.bugcontrol debian/nfs-common/usr/share/bug/nfs-common/control
        install -m 0755 debian/nfs-common.bugscript debian/nfs-common/usr/share/bug/nfs-common/script
@@ -67,6 +71,7 @@ binary-arch: build
        dh_strip
        dh_compress
        dh_fixperms
+       chmod +x debian/nfs-common/usr/lib/systemd/scripts/nfs-utils_env.sh
        chmod u+s debian/nfs-common/sbin/mount.nfs
        dh_installdeb
        dh_shlibdeps
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644 (file)
index 0000000..dea3f82
--- /dev/null
@@ -0,0 +1,4 @@
+Tests: local-server-client
+Depends: nfs-kernel-server
+# we need machine isolation as we need to modprobe stuff
+Restrictions: needs-root, isolation-machine, breaks-testbed
diff --git a/debian/tests/local-server-client b/debian/tests/local-server-client
new file mode 100644 (file)
index 0000000..549ab0c
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh
+# install server and client, do some mounts, verify that it boots and works
+set -e
+
+if ! [ -x /tmp/autopkgtest-reboot ]; then
+    echo "SKIP: testbed does not support rebooting"
+    exit 0
+fi
+
+pre_boot_setup() {
+    # set up some exports
+    cat <<EOF >> /etc/exports
+/home localhost(rw,no_root_squash,no_subtree_check)
+/var/log/ localhost(ro,no_root_squash,subtree_check)
+EOF
+
+    # set up client mounts
+    mkdir -p /mnt/nfs_home /mnt/nfs_log
+    cat << EOF >> /etc/fstab
+localhost:/home /mnt/nfs_home nfs defaults,nofail 0 0
+localhost:/var/log /mnt/nfs_log nfs defaults,nofail 0 0
+EOF
+}
+
+fail() {
+    echo "FAIL: $1" >&2
+    exit 1
+}
+
+post_boot_tests() {
+    # ensure we have our mounts
+    mount | grep 'localhost:.*nfs_home' || fail "nfs_home not mounted"
+    mount | grep 'localhost:.*nfs_log' || fail "nfs_log not mounted"
+
+    # test that we can write to NFS export and get it in /home
+    [ ! -e /home/hello.txt ] || fail "/home/hello.txt already exists"
+    echo world > /mnt/nfs_home/hello.txt
+    sync
+    [ -e /home/hello.txt ] || fail "/home/hello.txt does not exist"
+    [ "$(cat /home/hello.txt)" = "world" ] || fail "/home/hello.txt has wrong contents"
+
+    # test that we can write to /home and get it in NFS
+    rm /home/hello.txt
+    sync
+    [ ! -e /mnt/nfs_home/hello.txt ] || fail "/mnt/nfs_home/hello.txt exists after removal"
+
+    # read-only, should fail
+    ! touch /mnt/nfs_log/pwned 2>/dev/null || fail "writing to r/o /mnt/nfs_log succeeded"
+
+    # our systemd jobs have a rather delicate dependency structure and run
+    # early; ensure that we did not run into any cycles
+    if [ -d /run/systemd/system ]; then
+        if journalctl | grep 'Found ordering cycle'; then
+            journalctl -p warning || true
+            fail "found ordering cycle in units"
+        fi
+    fi
+}
+
+if [ -z "$ADT_REBOOT_MARK" ]; then
+    pre_boot_setup
+    /tmp/autopkgtest-reboot boot1
+else
+    post_boot_tests
+fi