- new upstream nfs-utils-1.3.1

This brings numerous fixes, particularly to gssd and
  nfsdcltrack.  It incorporates all the upstreamable
  patches we had:
- Delete  nfsdcltrack.sbin.patch
- Delete  start-statd.patch
- 0001-nfs-client.target-Removed-a-ordering-cycle-with-nfs-.patch
  0002-Centralize-dependencies-on-the-auth-unit.patch
  Patches from 1.3.2-rc, which look useful
- Convert from /etc/init.d startup scripts to full
  systemd integration.
  The upstream standard names are "nfs-client" and "nfs-server"
  rather than "nfs" and "nfsserver", so local "nfs" "nfsserver"
  aliases are created and "rcXXX" links are provided for all 4.

OBS-URL: https://build.opensuse.org/package/show/Base:System/nfs-utils?expand=0&rev=134
This commit is contained in:
Neil Brown 2014-11-05 00:53:10 +00:00 committed by Git OBS Bridge
parent 0ef7cdb5f5
commit 56601d6192
17 changed files with 325 additions and 881 deletions

View File

@ -0,0 +1,37 @@
From 12a95edae598ba0c63a30b07d7b3529871e145e2 Mon Sep 17 00:00:00 2001
From: Steve Dickson <steved@redhat.com>
Date: Mon, 29 Sep 2014 11:23:39 -0400
Subject: [PATCH 1/2] nfs-client.target: Removed a ordering cycle with
nfs-server.service
On a VM that boots very fast and with out kerberos
enabled a systemd ordering cycle happens between
nfs-client and nfs-server units when both were
enabled.
Having nfs-client start the gssd daemons in the
same matter as the nfs-server does ('After=') seemed
to eliminated the ordering cycle.
Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
systemd/nfs-client.target | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/systemd/nfs-client.target b/systemd/nfs-client.target
index 474f5e9ad74b..87a1ce8cec8f 100644
--- a/systemd/nfs-client.target
+++ b/systemd/nfs-client.target
@@ -7,7 +7,7 @@ Wants=remote-fs-pre.target
# start that on demand if needed.
Wants=rpc-gssd.service rpc-svcgssd.service auth-rpcgss-module.service
Wants=nfs-blkmap.service rpc-statd-notify.service
-Before=rpc-gssd.service rpc-svcgssd.service nfs-blkmap.service
+After=rpc-gssd.service rpc-svcgssd.service nfs-blkmap.service
[Install]
WantedBy=multi-user.target
--
2.1.1

View File

@ -0,0 +1,87 @@
From 8d51c77c81f0cd5b0b8508eb50d5a53d6d2375ae Mon Sep 17 00:00:00 2001
From: Simo Sorce <simo@redhat.com>
Date: Tue, 30 Sep 2014 15:33:10 -0400
Subject: [PATCH 2/2] Centralize dependencies on the auth unit.
With this patch either gssproxy or rpc.svcgssd are started only if the
auth module is requested, and it finds a keytab.
If the wants are in the main nfs-client or nfs-server unit files then
the two deamons are started unconditionally and would require
conditions which we can test once and for all in a single unit file
instead.
Change also Before and After statments accordingly to properly
serialize loading modules and starting daemons in 3 steps
1. load kernel GSS auth module
2. start GSS handling daemons
3. start NFS client/server daemons
Signed-off-by: Simo Sorce <simo@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
systemd/auth-rpcgss-module.service | 3 ++-
systemd/nfs-client.target | 7 +++++--
systemd/nfs-server.service | 8 +++++---
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/systemd/auth-rpcgss-module.service b/systemd/auth-rpcgss-module.service
index 3fc2f4ac924f..0355e13e0095 100644
--- a/systemd/auth-rpcgss-module.service
+++ b/systemd/auth-rpcgss-module.service
@@ -6,7 +6,8 @@
# unit will fail. But that's OK.)
[Unit]
Description=Kernel Module supporting RPCSEC_GSS
-Before=gssproxy.service rpc-svcgssd.service
+Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
+Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
ConditionPathExists=/etc/krb5.keytab
[Service]
diff --git a/systemd/nfs-client.target b/systemd/nfs-client.target
index 87a1ce8cec8f..9b792a363e14 100644
--- a/systemd/nfs-client.target
+++ b/systemd/nfs-client.target
@@ -5,9 +5,12 @@ 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=rpc-gssd.service rpc-svcgssd.service auth-rpcgss-module.service
Wants=nfs-blkmap.service rpc-statd-notify.service
-After=rpc-gssd.service rpc-svcgssd.service nfs-blkmap.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
diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
index 1048c5cbbf68..8010aadc4870 100644
--- a/systemd/nfs-server.service
+++ b/systemd/nfs-server.service
@@ -2,15 +2,17 @@
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 auth-rpcgss-module.service
-Wants=rpc-gssd.service gssproxy.service rpc-svcgssd.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
-After= rpc-gssd.service gssproxy.service rpc-svcgssd.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
--
2.1.1

4
nfs-client.nfs.conf Normal file
View File

@ -0,0 +1,4 @@
# When nfs is stopped or restarted, nfs-client must too.
[Unit]
PartOf=nfs-client.target

4
nfs-config.restart.conf Normal file
View File

@ -0,0 +1,4 @@
[Unit]
# Ensure config file is re-processed when nfs or nfsserver
# is restarted
PartOf = nfs-server.service nfs-client.target

View File

@ -0,0 +1,4 @@
# When nfsserver is stopped or restarted, nfs-server must too.
[Unit]
PartOf=nfsserver.service

View File

@ -6,9 +6,9 @@
support/nfs/exports.c | 2 ++
1 file changed, 2 insertions(+)
--- nfs-utils-1.2.7.orig/support/nfs/exports.c
+++ nfs-utils-1.2.7/support/nfs/exports.c
@@ -628,6 +628,8 @@ bad_option:
--- nfs-utils-1.3.1.orig/support/nfs/exports.c
+++ nfs-utils-1.3.1/support/nfs/exports.c
@@ -649,6 +649,8 @@ bad_option:
} else if (strncmp(opt, "replicas=", 9) == 0) {
ep->e_fslocmethod = FSLOC_REPLICA;
ep->e_fslocdata = strdup(opt+9);

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ab8384d0e487ed6a18c5380d5df28015f7dd98680bf08f3247c97d9f7d99e56f
size 578960

3
nfs-utils-1.3.1.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ff79d70b7b58b2c8f9b798c58721127e82bb96022adc04a5c4cb251630e696b8
size 583124

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Wed Nov 5 00:48:09 UTC 2014 - nfbrown@suse.com
- new upstream nfs-utils-1.3.1
This brings numerous fixes, particularly to gssd and
nfsdcltrack. It incorporates all the upstreamable
patches we had:
- Delete nfsdcltrack.sbin.patch
- Delete start-statd.patch
- 0001-nfs-client.target-Removed-a-ordering-cycle-with-nfs-.patch
0002-Centralize-dependencies-on-the-auth-unit.patch
Patches from 1.3.2-rc, which look useful
- Convert from /etc/init.d startup scripts to full
systemd integration.
The upstream standard names are "nfs-client" and "nfs-server"
rather than "nfs" and "nfsserver", so local "nfs" "nfsserver"
aliases are created and "rcXXX" links are provided for all 4.
-------------------------------------------------------------------
Thu Sep 4 02:55:22 UTC 2014 - nfbrown@suse.com

View File

@ -41,30 +41,34 @@ Url: http://kernel.org/pub/linux/utils/nfs-utils/
Summary: Support Utilities for Kernel nfsd
License: GPL-2.0+
Group: Productivity/Networking/NFS
Version: 1.3.0
Version: 1.3.1
Release: 0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %fillup_prereq %insserv_prereq
PreReq: %fillup_prereq
%{?systemd_requires}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: http://kernel.org/pub/linux/utils/nfs-utils/%{version}/nfs-utils-%{version}.tar.xz
# Download does not work:
# Source1: ftp://nfs.sourceforge.net/pub/nfs/nfs.doc.tar.bz2
Source1: nfs.doc.tar.bz2
Source2: nfs.init
Source3: nfsserver.init
Source4: sysconfig.nfs
Source5: nfs-kernel-server.xml
Source6: README.NFSv4
Source7: fw-client
Source8: fw-server
Source11: idmapd.conf
Source12: nfs-config.restart.conf
Source13: nfs-utils.rpmlintrc
Source14: nfs-utils_env.sh
Source15: nfsserver.service
Source16: nfs.service
Source17: nfs-server.nfsserver.conf
Source18: nfs-client.nfs.conf
Patch0: nfs-utils-1.0.7-bind-syntax.patch
# PATCH-FIX-UPSTREAM nfsdcltrack.sbin.patch nfbrown@suse.de
Patch1: nfsdcltrack.sbin.patch
# PATCH-FIX-OPENSUSE start-statd.patch nfbrown@suse.de
Patch2: start-statd.patch
# PATCH-FIX-UPSTREAM 0001-nfs-client.target-Removed-a-ordering-cycle-with-nfs-.patch nfbrown@suse.de
Patch1: 0001-nfs-client.target-Removed-a-ordering-cycle-with-nfs-.patch
# PATCH-FIX-UPSTREAM 0002-Centralize-dependencies-on-the-auth-unit.patch nfbrown@suse.de
Patch2: 0002-Centralize-dependencies-on-the-auth-unit.patch
Suggests: python-base
%description
@ -79,9 +83,8 @@ Obsoletes: nfs-utils < 1.1.0
Requires: keyutils
Requires: netcfg
Requires: rpcbind
PreReq: %fillup_prereq %insserv_prereq
PreReq: %fillup_prereq
PreReq: permissions
Provides: aaa_base:/etc/init.d/nfs
%description -n nfs-client
This package contains common NFS utilities which are needed for client
@ -96,7 +99,7 @@ Conflicts: nfs-server
Requires: netcfg
Requires: nfs-client = %{version}
Requires: rpcbind
PreReq: %fillup_prereq %insserv_prereq
PreReq: %fillup_prereq
%description -n nfs-kernel-server
This package contains support for the kernel based NFS server. You can
@ -144,17 +147,26 @@ done
%install
make install DESTDIR=$RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/%{_unitdir}
install -m 644 systemd/rpc-statd.service $RPM_BUILD_ROOT/%{_unitdir}
# rc-script
install -d $RPM_BUILD_ROOT/etc/init.d
install -m 744 %{SOURCE3} $RPM_BUILD_ROOT/etc/init.d/nfsserver
install -m 744 %{SOURCE2} $RPM_BUILD_ROOT/etc/init.d/nfs
ln -sf ../../etc/init.d/nfsserver $RPM_BUILD_ROOT/usr/sbin/rcnfsserver
ln -sf ../../etc/init.d/nfs $RPM_BUILD_ROOT/usr/sbin/rcnfs
install -m 644 systemd/*.{service,target,mount} $RPM_BUILD_ROOT/%{_unitdir}
install -m 644 %{S:15} $RPM_BUILD_ROOT%{_unitdir}/nfsserver.service
install -m 644 %{S:16} $RPM_BUILD_ROOT%{_unitdir}/nfs.service
install -d $RPM_BUILD_ROOT%{_unitdir}/nfs-server.service.d
install -m 644 %{S:17} $RPM_BUILD_ROOT%{_unitdir}/nfs-server.service.d/nfsserver.conf
install -d $RPM_BUILD_ROOT%{_unitdir}/nfs-client.target.d
install -m 644 %{S:18} $RPM_BUILD_ROOT%{_unitdir}/nfs-client.target.d/nfs.conf
install -d $RPM_BUILD_ROOT/usr/lib/systemd/scripts
install -m 755 %{S:14} $RPM_BUILD_ROOT/usr/lib/systemd/scripts/nfs-utils_env.sh
install -d $RPM_BUILD_ROOT%{_unitdir}/nfs-config.service.d
install -m 644 %{S:12} $RPM_BUILD_ROOT%{_unitdir}/nfs-config.service.d/restart.conf
ln -sf /sbin/service $RPM_BUILD_ROOT/usr/sbin/rcnfsserver
ln -sf /sbin/service $RPM_BUILD_ROOT/usr/sbin/rcnfs-server
ln -sf /sbin/service $RPM_BUILD_ROOT/usr/sbin/rcnfs
ln -sf /sbin/service $RPM_BUILD_ROOT/usr/sbin/rcnfs-client
# sysconfig-data
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/var/adm/fillup-templates
# idmapd setup
install -d $RPM_BUILD_ROOT/etc
install -m 644 %{S:11} $RPM_BUILD_ROOT/etc/idmapd.conf
mkdir -p -m 755 $RPM_BUILD_ROOT/var/lib/nfs/rpc_pipefs
mkdir -p -m 755 $RPM_BUILD_ROOT/var/lib/nfs/v4recovery
@ -192,7 +204,7 @@ if [ -f /var/lock/subsys/nfsserver-rpc.idmapd ]; then
mv /var/lock/subsys/nfsserver-rpc.idmapd /run/nfs
fi
###
%{fillup_and_insserv -n nfs nfs}
%{fillup_only -n nfs nfs}
#
%set_permissions /sbin/mount.nfs
%service_add_post nfs
@ -203,7 +215,6 @@ fi
%postun -n nfs-client
%restart_on_update nfs
%insserv_cleanup
%service_del_postun nfs
%verifyscript -n nfs-client
@ -226,17 +237,14 @@ if [ -f /var/lock/subsys/nfsserver-rpc.idmapd ]; then
mv /var/lock/subsys/nfsserver-rpc.idmapd /run/nfs
fi
###
%{fillup_and_insserv nfsserver}
%service_add_post nfsserver
%postun -n nfs-kernel-server
%restart_on_update nfsserver
%insserv_cleanup
%service_del_postun nfsserver
%files -n nfs-client
%defattr(-,root,root)
%config /etc/init.d/nfs
%config /etc/idmapd.conf
%config /etc/nfsmount.conf
%verify(not mode) %attr(0755,root,root) /sbin/mount.nfs
@ -249,6 +257,7 @@ fi
/usr/sbin/nfsidmap
/usr/sbin/nfsstat
/usr/sbin/rcnfs
/usr/sbin/rcnfs-client
/usr/sbin/rpc.gssd
/usr/sbin/rpc.idmapd
/usr/sbin/rpc.statd
@ -257,7 +266,25 @@ fi
/usr/sbin/sm-notify
/usr/sbin/start-statd
/usr/sbin/blkmapd
%{_unitdir}/auth-rpcgss-module.service
%{_unitdir}/nfs-blkmap.service
%{_unitdir}/nfs-blkmap.target
%{_unitdir}/nfs-client.target
%{_unitdir}/nfs-config.service
%{_unitdir}/nfs-idmapd.service
%{_unitdir}/nfs-utils.service
%{_unitdir}/rpc-gssd.service
%{_unitdir}/rpc-statd-notify.service
%{_unitdir}/rpc-statd.service
%{_unitdir}/rpc-svcgssd.service
%{_unitdir}/var-lib-nfs-rpc_pipefs.mount
%{_unitdir}/nfs.service
%dir %{_unitdir}/nfs-client.target.d
%{_unitdir}/nfs-client.target.d/nfs.conf
%dir %{_unitdir}/nfs-config.service.d
%{_unitdir}/nfs-config.service.d/restart.conf
%dir /usr/lib/systemd/scripts
/usr/lib/systemd/scripts/nfs-utils_env.sh
%{_mandir}/man5/nfsmount.conf.5.gz
%{_mandir}/man5/nfs.5.gz
%{_mandir}/man8/mount.nfs.8.gz
@ -289,9 +316,15 @@ fi
%files -n nfs-kernel-server
%defattr(-,root,root)
%config /etc/init.d/nfsserver
%{_unitdir}/nfs-mountd.service
%{_unitdir}/nfs-server.service
%{_unitdir}/proc-fs-nfsd.mount
%{_unitdir}/nfsserver.service
%dir %{_unitdir}/nfs-server.service.d
%{_unitdir}/nfs-server.service.d/nfsserver.conf
/usr/sbin/exportfs
/usr/sbin/rcnfsserver
/usr/sbin/rcnfs-server
/usr/sbin/rpc.mountd
/usr/sbin/rpc.nfsd
/usr/sbin/rpc.svcgssd

62
nfs-utils_env.sh Normal file
View File

@ -0,0 +1,62 @@
#!/bin/sh
# extract configuration from /etc/sysconfig/nfs-utils and write
# environment to /run/sysconfig/nfs-utils to be used by systemd unit
# files.
# This script expects configuration as used by openSUSE-13.1 and later
#
nfs_config=/etc/sysconfig/nfs
if test -r $nfs_config; then
. $nfs_config
fi
pipefs=
if [ -n "$RPC_PIPEFS_DIR" -a "$RPC_PIPEFS_DIR" != "/var/lib/nfs/rpc_pipefs" ]; then
pipefs="-p /var/lib/nfs/rpc_pipefs"
fi
mountdport=
if [ -n "$MOUNTD_PORT" ]; then
mountdport="-p $MOUNTD_PORT"
fi
case $NFS_GSSD_AVOID_DNS in
[Nn]*) ignore_dns=-D ;;
[Yy]*) ignore_dns= ;;
* ) ignore_dns=-D
esac
version_params=
if [ "$NFS3_SERVER_SUPPORT" == "no" ]; then
version_params="--no-nfs-version 2 --no-nfs-version 3"
fi
if [ "$NFS4_SUPPORT" != "yes" ]; then
version_params="--no-nfs-version 4"
fi
if [ "$NFS4_SERVER_MINOR_VERSION" != "0" ]; then
version_params="$VERSION_PARAMS --nfs-version 4 --nfs-version 4.$NFS4_SERVER_MINOR_VERSION"
fi
if [ "$USE_KERNEL_NFSD_NUMBER" -gt 0 ]; then
threads=$USE_KERNEL_NFSD_NUMBER
else
threads=3
fi
case $NFS_GSSD_AVOID_DNS in
[Nn]*) ignore_dns=-D ;;
[Yy]*) ignore_dns= ;;
* ) ignore_dns=-D
esac
mkdir -p /run/sysconfig
{
echo "RPCIDMAPDARGS=$pipefs"
echo "RPCMOUNTDARGS=$mountdport $MOUNTD_OPTIONS $version_parms"
echo "RPCNFSDARGS=$NFSD_OPTIONS $version_params $threads"
echo "GSSDARGS=$ignore_dns $GSSD_OPTIONS $pipefs"
echo "SMNOTIFYARGS=$SM_NOTIFY_OPTIONS"
echo "STATDARGS=$STATD_OPTIONS"
echo "SVCGSSDARGS=$SVCGSSD_OPTIONS"
} > /run/sysconfig/nfs-utils

399
nfs.init
View File

@ -1,399 +0,0 @@
#! /bin/bash
# Copyright (c) 1996-2002 SuSE Linux AG, Nuernberg, Germany.
# Copyright (c) 2008 SuSE LINUX Products GmbH, Nuernberg, Germany.
# All rights reserved.
#
# Author: Florian La Roche, 1996
# Werner Fink <werner@suse.de>, 1996,2008
# Burchard Steinbild, 1996
#
# Please send feedback to http://www.suse.de/feedback
#
# /etc/init.d/nfs
#
### BEGIN INIT INFO
# Provides: nfs
# Required-Start: $network $portmap
# Required-Stop: $network $portmap
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: NFS client services
# Description: All necessary services for NFS clients
# X-Systemd-RemainAfterExit: true
### END INIT INFO
. /etc/rc.status
. /etc/sysconfig/nfs
# XXX: there should be separate init scripts for these really
IDMAPD_BIN=/usr/sbin/rpc.idmapd
GSSD_BIN=/usr/sbin/rpc.gssd
STATD_BIN=/usr/sbin/rpc.statd
IDMAPD_CLIENT_STATE=/run/nfs/nfs-rpc.idmapd
IDMAPD_SERVER_STATE=/run/nfs/nfsserver-rpc.idmapd
GSSD_CLIENT_STATE=/run/nfs/nfs-rpc.gssd
GSSD_SERVER_STATE=/run/nfs/nfsserver-rpc.gssd
if [ -z "$RPC_PIPEFS_DIR" ]; then
RPC_PIPEFS_DIR=/var/lib/nfs/rpc_pipefs
fi
NEED_IDMAPD=no
#always start gssd, else kernel waits for it.
NEED_GSSD=yes
NEED_LDCONFIG=no
state=0
usr=""
opt=""
mnt=""
nfs=$NFS_START_SERVICES
if [ "x$nfs" != "xyes" ]
then nfs=no
fi
while read -r what where type options rest ; do
case "$what" in
\#*|"") continue ;;
esac
case ",$options," in
*,noauto,*) continue ;;
esac
case "$type" in
nfs|nfs4) ;;
*) continue ;;
esac
nfs=yes
if test "$1" = status ; then
grep -qF "$what $where nfs
$what/ $where nfs" /proc/mounts && continue
state=3
continue
fi
case "$where" in
/usr*)
usr="${usr:+$usr }$where"
NEED_LDCONFIG=yes
;;
/opt*)
opt="${opt:+$opt }$where"
NEED_LDCONFIG=yes
;;
*)
mnt="${mnt:+$mnt }$where"
test "$NEED_LDCONFIG" = yes && continue
grep -qE "^$where" /etc/ld.so.conf || continue
NEED_LDCONFIG=yes
;;
esac
done < /etc/fstab
unset what where type options rest
case $NFS_SECURITY_GSS in
[Nn]*) flavors="";;
[Yy]*) flavors=krb5;;
*) flavors="$NFS_SECURITY_GSS";;
esac
if test -n "$flavors" ; then
NEED_GSSD=yes
fi
if test -n "$GSSD_OPTIONS"; then
NEED_GSSD=yes
fi
case $NFS_GSSD_AVOID_DNS in
[Nn]*) ignore_dns=-D ;;
[Yy]*) ignore_dns= ;;
* ) ignore_dns=-D
esac
if test "$NFS4_SUPPORT" = yes ; then
NEED_IDMAPD=yes
fi
if grep -E '^(sunrpc|fs.nfs)' /etc/sysctl.conf > /dev/null 2>&1 ; then
nfs=yes
fi
check_portmap() {
# check if either portmap or rpcbind is running
if test -x /sbin/rpcinfo && /sbin/rpcinfo -a 0.0.0.0.0.111 -T tcp 100000 > /dev/null 2>&1
then true
elif test -x /sbin/portmap && checkproc /sbin/portmap
then true
elif test -x /sbin/rpcbind && checkproc /sbin/rpcbind
then true
else false
fi
}
if ! test "$nfs" = no -o -x /sbin/portmap -o -x /sbin/rpcbind; then
echo "portmap/rpcbind is missing"
rc_failed 3
rc_status -v
rc_exit
fi
mount_rpc_pipefs() {
# See if the file system is there yet
case `stat -c "%t" -f "$RPC_PIPEFS_DIR"` in
*67596969*)
return 0;;
esac
mount -t rpc_pipefs rpc_pipefs "$RPC_PIPEFS_DIR"
}
umount_rpc_pipefs() {
# See if the file system is there
case `stat -c "%t" -f "$RPC_PIPEFS_DIR"` in
*67596969*)
umount "$RPC_PIPEFS_DIR"
esac
}
mount_usr() {
test -n "$usr" -o -n "$opt" || return
local where
for where in $usr $opt ; do
mount -o nolock $where || {
# maybe network device hasn't appeared yet.
udevadm settle
mount -o nolock $where
}
done
}
do_start_gssd() {
for flavor in $flavors; do
/sbin/modprobe rpcsec_gss_$flavor
done
mount_rpc_pipefs
startproc $GSSD_BIN $ignore_dns $GSSD_OPTIONS -p $RPC_PIPEFS_DIR
return $?
}
do_start_idmapd() {
mount_rpc_pipefs
# as idmapd needs to be run by server and client
# check if there is already a idmapd running
if checkproc $IDMAPD_BIN && test -f $IDMAPD_SERVER_STATE; then
killproc -HUP $IDMAPD_BIN
else
startproc $IDMAPD_BIN -p $RPC_PIPEFS_DIR
return $?
fi
}
rc_reset
case "$1-$nfs" in
start-no|reload-no)
# Always run smnotify, even if no mounts are listed in fstab.
# If there is nothing to do, it will exit quickly, and if there
# is something to do, the sooner it is done, the better.
/usr/sbin/sm-notify $SM_NOTIFY_OPTIONS
echo -n "Not starting NFS client services - no NFS found in /etc/fstab:"
rc_status -u
;;
start-yes|force-start-*)
echo -n "Starting NFS client services:"
if ! check_portmap ; then
echo "portmap/rpcbind is not running"
rc_failed 3
rc_status -v
rc_exit
fi
# explicit modprobe so we can set some sysctl values
# before any daemons (e.g. lockd) start.
# When modprobe allows this to be moved to modprobe.d
# without breaking --show-depends, this can be removed.
modprobe nfs
grep -E '^(sunrpc|fs.nfs)' /etc/sysctl.conf | sysctl -q -e -n -p -
# in case we need /usr and/or /opt via nfs
mount_usr
# sm-notify
echo -n " sm-notify"
/usr/sbin/sm-notify $SM_NOTIFY_OPTIONS
# start gssd
if test "$NEED_GSSD" = yes ; then
echo -n " gssd"
do_start_gssd || {
rc_status -v
rc_exit
}
[ -d /run/nfs ] || mkdir /run/nfs
echo $GSSD_BIN > $GSSD_CLIENT_STATE
fi
# start idmapd
if test "$NEED_IDMAPD" = yes ; then
echo -n " idmapd"
do_start_idmapd || {
rc_status -v
rc_exit
}
[ -d /run/nfs ] || mkdir /run/nfs
echo $IDMAPD_BIN > $IDMAPD_CLIENT_STATE
fi
rc_status -v
# remark: statd is started when needed by mount.nfs
# Mount all auto NFS devices (-> nfs(5) and mount(8) )
# NFS-Server sometime not reachable during boot phase.
# It's sometime usefull to mount NFS devices in
# background with an ampersand (&) and a sleep time of
# two or more seconds, e.g:
#
# sleep 2 && mount -at nfs,nfs4 &
# sleep 2
#
if test -n "$mnt" ; then
# If network devices are not yet discovered, mounts
# might fail, so we might need to 'udevadm settle' to
# wait for the interfaces.
# We cannot try the mount and on failure: 'settle' and try again
# as if there are 'bg' mounts, we could get multiple copies
# of them. So always 'settle' if there is any mounting to do.
echo -n "Mounting network file systems ..."
udevadm settle
mount -at nfs,nfs4 || rc_failed 1
rc_status -v
fi
#
# generate new list of available shared libraries
#
if test "$NEED_LDCONFIG" = yes; then
if test -x /sbin/ldconfig; then
/sbin/ldconfig -X > /dev/null 2>&1 || :
fi
fi
#
;;
stop* )
echo -n "Shutting down NFS client services:"
rootfs=`awk '$2 == "/" && $1 != "rootfs" {print $3}' /proc/mounts`
if test x$rootfs = xnfs ; then
echo -n " root filesystem is on NFS"
rc_status -s
else
# kill process to maximise chance that umount succeeds
mnt=`awk '$3 ~ /^nfs4*$/ {print $2}' /proc/mounts`
runlevel=`runlevel | awk '{print $2}'`
if test "$runlevel" -eq 0 -o "$runlevel" -eq 6; then
if test -n "$mnt" ; then
/sbin/mkill -TERM $mnt
fi
fi
# if filesystems are not busy, wait for unmount to complete..
umount -at nfs,nfs4
# if they are still busy, do a lazy unmount anyway.
umount -alt nfs,nfs4
# stop gssd
if test ! -f $GSSD_SERVER_STATE ; then
if checkproc $GSSD_BIN; then
echo -n " gssd"
killproc $GSSD_BIN
fi
rm -f $GSSD_CLIENT_STATE
fi
# stop idmapd
if test -f $IDMAPD_CLIENT_STATE; then
# only stop idmapd if it is not needed by server
if test ! -f $IDMAPD_SERVER_STATE ; then
echo -n " idmapd"
killproc $IDMAPD_BIN
fi
rm -f $IDMAPD_CLIENT_STATE
fi
# stop rpc.statd if not needed by server
if checkproc $STATD_BIN ; then
if [ `cat /proc/fs/nfsd/threads 2> /dev/null`0 -eq 0 ]; then
echo -n " rpc.statd"
killproc $STATD_BIN
fi
fi
# umount rpc_pipefs only if not needed by server
if [ ! -f $GSSD_SERVER_STATE -a ! -f $IDMAPD_SERVER_STATE ]; then
umount_rpc_pipefs
fi
rc_status -v
fi
;;
reload*|force-reload*)
# only IDMAP has any sense in which 'reload' makes sense.
if checkproc $IDMAPD_BIN; then
killproc -HUP $IDMAPD_BIN
fi
rc_status
;;
restart*)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 force-start
rc_status
;;
status*)
echo -n "Checking for mounted nfs shares (from /etc/fstab):"
if test "$nfs" = yes ; then
rc_failed $state
else
rc_failed 3
fi
#
if test "$NEED_GSSD" = yes && ! checkproc $GSSD_BIN; then
echo "gssd not running"
rc_failed 3
fi
#
if test "$NEED_IDMAPD" = yes && ! checkproc $IDMAPD_BIN; then
echo "idmapd not running"
rc_failed 3
fi
if ! check_portmap; then
echo "Warning: portmap/rpcbind not running - nfs may not work well"
fi
rc_status -v
;;
try-restart*|condrestart*)
# This restart is not only conditional on the services already
# running, but is also gentler in that NFS filesystems are
# not unmounted or remounted.
# It is possible that the programs have been reinstalled so
# we pass a basename rather than a full path to checkproc and killproc
echo -n "Restarting NFS services:"
if checkproc ${GSSD_BIN##*/}; then
echo -n " gssd"
killproc ${GSSD_BIN##*/}
startproc $GSSD_BIN $ignore_dns $GSSD_OPTIONS
fi
if checkproc ${IDMAPD_BIN##*/}; then
echo -n " idmapd"
killproc ${IDMAPD_BIN##*/}
startproc $IDMAPD_BIN
fi
if checkproc ${STATD_BIN##*/}; then
echo -n " statd"
killproc ${STATD_BIN##*/}
/usr/sbin/start-statd
fi
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|reload|force-reload|restart|try-restart}"
exit 1
esac
rc_exit

22
nfs.service Normal file
View File

@ -0,0 +1,22 @@
[Unit]
Description=Alias for NFS client
# The systemd alias mechanism (using symlinks) isn't rich enough.
# If you "systemctl enable" an alias, it doesn't enable the
# target.
# This service file creates a sufficiently rich alias for nfs-client
# (which is the canonical upstream name)
# "start", "stop", "restart", "reload" on this will do the same to nfs-client.
# "enable" on this will only enable this service, but when it starts, that
# starts nfs-client, so it is effectively enabled.
# nfs-server.d/nfsserver.conf is part of this service.
Requires= nfs-client.target
PropagatesReloadTo=nfs-client.target
[Service]
Type=oneshot
ExecStart=/bin/true
[Install]
WantedBy=multi-user.target

View File

@ -1,16 +0,0 @@
---
utils/nfsdcltrack/Makefile.am | 4 ++++
1 file changed, 4 insertions(+)
--- nfs-utils-1.2.8.orig/utils/nfsdcltrack/Makefile.am
+++ nfs-utils-1.2.8/utils/nfsdcltrack/Makefile.am
@@ -1,5 +1,9 @@
## Process this file with automake to produce Makefile.in
+# These binaries go in /sbin (not /usr/sbin), and that cannot be
+# overridden at config time. The kernel "knows" the /sbin name.
+sbindir = /sbin
+
man8_MANS = nfsdcltrack.man
EXTRA_DIST = $(man8_MANS)

View File

@ -1,416 +0,0 @@
#! /bin/sh
# Copyright (c) 1996 - 2007 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# Author: Florian La Roche <florian@suse.de>, 1996
# Werner Fink <werner@suse.de>, 1996,98
# Burchard Steinbild <bs@suse.de>, 1997
# Thorsten Kukuk <kukuk@suse.de>, 2000,01
#
# /etc/init.d/nfsserver
#
### BEGIN INIT INFO
# Provides: nfsserver
# Required-Start: $network $named $portmap
# Required-Stop: $network $portmap
# Should-Start: ypbind krb5kdc
# Should-Stop: ypbind krb5kdc
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Start the kernel based NFS daemon
# X-Systemd-RemainAfterExit: true
### END INIT INFO
. /etc/sysconfig/nfs
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
# XXX: there should be separate init scripts for these really
SVCGSSD_BIN=/usr/sbin/rpc.svcgssd
GSSD_BIN=/usr/sbin/rpc.gssd
IDMAPD_BIN=/usr/sbin/rpc.idmapd
NFSD_BIN=/usr/sbin/rpc.nfsd
IDMAPD_CLIENT_STATE=/run/nfs/nfs-rpc.idmapd
IDMAPD_SERVER_STATE=/run/nfs/nfsserver-rpc.idmapd
NFSD_BIND_MOUNTS=/run/nfs/bind.mounts
GSSD_CLIENT_STATE=/run/nfs/nfs-rpc.gssd
GSSD_SERVER_STATE=/run/nfs/nfsserver-rpc.gssd
NEED_SVCGSSD=no
NEED_IDMPAPD=no
case `uname -r` in
0.*|1.*|2.0.*) exit 3
esac
case $NFS_SECURITY_GSS in
[Nn]*) flavors="";;
[Yy]*) flavors=krb5;;
*) flavors="$NFS_SECURITY_GSS";;
esac
if [ "$flavors" ]; then
NEED_SVCGSSD=yes
fi
if [ "$NFS4_SUPPORT" = yes ]; then
NEED_IDMAPD=yes
fi
if [ -z "$RPC_PIPEFS_DIR" ]; then
RPC_PIPEFS_DIR=/var/lib/nfs/rpc_pipefs
fi
case "$NFS4_SERVER_MINOR_VERSION" in
[0123456789] ) ;;
* ) NFS4_SERVER_MINOR_VERSION=0
esac
if [ -n "$NFSV4LEASETIME" ] ; then
# Documentation inconsistency.
NFSV4LEASETIME=$NFSD_V4_GRACE
fi
check_for_nfsdfs() {
HAVE_NFSDFS="no"
while read dummy type ; do
if [ "$type" = "nfsd" ] ; then
HAVE_NFSDFS="yes"
fi
done < /proc/filesystems
}
nfs4_bind_mounts() {
[ -d /run/nfs ] || mkdir /run/nfs
warned=no
# In case of doubt, try "man sed" :-)
cat /etc/exports |
sed -n 'H;g;s/\\$//;h;t;s/^\n//;s/\n[[:space:]]*//g;s/#.*//;p;s/.*//;h' |
sed 's/^\([^[:space:]]*\).*bind=\([^,)]*\).*/\1 \2/;t;d' |
sort |
while read export dir; do
if [ $warned = no ] ; then
echo
echo "NFS: The usage of 'bind=' in /etc/exports is deprecated."
echo "NFS: Is it no longer needed and may cease to work."
echo "NFS: Please remove these settings."
warned=yes
fi >&2
test -d "$export" || mkdir -p "$export"
mount -o bind "$dir" "$export"
echo "$dir" "$export"
done > $NFSD_BIND_MOUNTS
}
nfs4_unbind_mounts() {
sort -r -k2 $NFSD_BIND_MOUNTS |
while read src mountpoint crap; do
[ -n "$mountpoint" ] && umount -l "$mountpoint"
done
> $NFSD_BIND_MOUNTS
}
mount_rpc_pipefs() {
# See if the file system is there yet
case `stat -c "%t" -f "$RPC_PIPEFS_DIR"` in
*67596969*)
return 0;;
esac
mount -t rpc_pipefs rpc_pipefs "$RPC_PIPEFS_DIR"
}
umount_rpc_pipefs() {
case `stat -c "%t" -f "$RPC_PIPEFS_DIR"` in
*67596969*)
umount "$RPC_PIPEFS_DIR";;
esac
}
do_start_svcgssd() {
for flavor in $flavors; do
/sbin/modprobe rpcsec_gss_$flavor
done
mount_rpc_pipefs
startproc $SVCGSSD_BIN $SVCGSSD_OPTIONS
return $?
}
do_start_gssd() {
if ! checkproc $GSSD_BIN; then
case $NFS_GSSD_AVOID_DNS in
[Nn]*) ignore_dns=-D ;;
[Yy]*) ignore_dns= ;;
* ) ignore_dns=-D
esac
mount_rpc_pipefs
startproc $GSSD_BIN $ignore_dns $GSSD_OPTIONS -p $RPC_PIPEFS_DIR
return $?
fi
}
do_start_idmapd() {
mount_rpc_pipefs
if checkproc $IDMAPD_BIN && test -f $IDMAPD_CLIENT_STATE; then
killproc -HUP $IDMAPD_BIN
else
startproc $IDMAPD_BIN -p $RPC_PIPEFS_DIR
return $?
fi
}
case "$1" in
start)
PARAMS=3
test "$USE_KERNEL_NFSD_NUMBER" -gt 0 && PARAMS="$USE_KERNEL_NFSD_NUMBER"
echo -n "Starting kernel based NFS server:"
modprobe nfsd
# this can be removed when modprobe allows the sysctl to be
# moved to modprobe.d without breaking --show-depends
grep '^fs.nfs.n[sl]m' /etc/sysctl.conf | sysctl -q -e -n -p -
# mount nfsd filesystem
check_for_nfsdfs
if [ "$HAVE_NFSDFS" = "yes" -a ! -f /proc/fs/nfsd/exports ] ; then
mount -t nfsd nfsd /proc/fs/nfsd
rc_status
fi
VERSION_PARAMS=
if [ "$NFS3_SERVER_SUPPORT" == "no" ]; then
VERSION_PARAMS="--no-nfs-version 2 --no-nfs-version 3"
fi
if [ "$NFS4_SUPPORT" != "yes" ]; then
VERSION_PARAMS="--no-nfs-version 4"
fi
if [ "$NFS4_SERVER_MINOR_VERSION" != "0" ]; then
VERSION_PARAMS="$VERSION_PARAMS --nfs-version 4 --nfs-version 4.$NFS4_SERVER_MINOR_VERSION"
fi
for fl in /proc/fs/nfsd/nfsv4leasetime /proc/fs/nfsd/nfsv4gracetime /proc/sys/fs/nfs/nlm_grace_period
do
if [ -n "$NFSV4LEASETIME" -a -f $fl ]; then
echo "$NFSV4LEASETIME" > $fl
fi
done
nfs4_bind_mounts
# svcgssd; gssd; idmapd
if [ "$NEED_SVCGSSD" = yes ]; then
echo -n " svcgssd"
do_start_svcgssd || {
rc_status -v
rc_exit
}
echo -n " gssd"
do_start_gssd || {
rc_status -v
rc_exit
}
[ -d /run/nfs ] || mkdir /run/nfs
echo $GSSD_BIN > $GSSD_SERVER_STATE
fi
if [ "$NEED_IDMAPD" = yes ]; then
echo -n " idmapd"
do_start_idmapd || {
rc_status -v
rc_exit
}
[ -d /run/nfs ] || mkdir /run/nfs
echo $IDMAPD_BIN > $IDMAPD_SERVER_STATE
fi
# exportfs
/usr/sbin/exportfs -r
# rpc.mountd
echo -n " mountd"
if [ -n "$MOUNTD_PORT" ] ; then
startproc /usr/sbin/rpc.mountd -p $MOUNTD_PORT $MOUNTD_OPTIONS $VERSION_PARAMS
else
startproc /usr/sbin/rpc.mountd $MOUNTD_OPTIONS $VERSION_PARAMS
fi || {
rc_status -v
rc_exit
}
# rpc.statd
if [ "$NFS3_SERVER_SUPPORT" != "no" ]; then
echo -n " statd"
startproc /usr/sbin/rpc.statd --no-notify $STATD_OPTIONS || {
rc_status -v
rc_exit
}
fi
# rpc.nfsd
echo -n " nfsd"
$NFSD_BIN $NFSD_OPTIONS $PARAMS $VERSION_PARAMS || {
rc_status -v
rc_exit
}
# sm-notify needs to be run last
echo -n " sm-notify"
/usr/sbin/sm-notify $SM_NOTIFY_OPTIONS
#
rc_status -v
;;
stop)
echo -n "Shutting down kernel based NFS server:"
# rpc.nfsd
echo -n " nfsd"
killproc -n -KILL nfsd || {
rc_status -v
rc_exit
}
# rpc.statd
if ! checkproc -n lockd; then
echo -n " statd"
killproc rpc.statd
else
# tell lockd to drop all client locks
killproc -n -KILL lockd
fi
# make sure sm-notify is run on restart, as we have dropped some locks
rm -f /run/sm-notify.pid
#
# rpc.mountd
echo -n " mountd"
killproc -TERM /usr/sbin/rpc.mountd || {
rc_status -v
rc_exit
}
# svcgssd
if [ "$NEED_SVCGSSD" = yes ]; then
echo -n " svcgssd"
killproc $SVCGSSD_BIN || {
rc_status -v
rc_exit
}
# kill only if not needed by client anymore
if [ ! -f $GSSD_CLIENT_STATE ]; then
echo -n " gssd"
killproc $GSSD_BIN || {
rc_status -v
rc_exit
}
fi
rm -f $GSSD_SERVER_STATE
fi
# idmap
if [ "$NEED_IDMAPD" = yes ]; then
# kill only if not needed by client anymore
if [ ! -f $IDMAPD_CLIENT_STATE ]; then
echo -n " idmapd"
killproc $IDMAPD_BIN
fi
rm -f $IDMAPD_SERVER_STATE
fi
# umount rpc_pipefs only if not needed by client
if [ ! -f $GSSD_CLIENT_STATE -a ! -f $IDMAPD_CLIENT_STATE ] ; then
umount_rpc_pipefs
fi
# umount nfsd fs
check_for_nfsdfs
if [ "$HAVE_NFSDFS" = "yes" -a -f /proc/fs/nfsd/exports ] ; then
umount /proc/fs/nfsd
rc_status
fi
nfs4_unbind_mounts
#
rc_status -v
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
$0 status >/dev/null && $0 restart
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
reload|force-reload)
echo -n "Reload kernel based NFS server"
# Unfortunately, there's no sane way of doing this:
nfs4_unbind_mounts; nfs4_bind_mounts
/usr/sbin/exportfs -r
rc_status -v
;;
status)
echo -n "Checking for kernel based NFS server:"
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
if [ "$NEED_SVCGSSD" = yes ]; then
echo -n " svcgssd"
checkproc $SVCGSSD_BIN
rc_status -v
echo -n " gssd"
checkproc $GSSD_BIN
rc_status -v
fi
if [ "$NEED_IDMAPD" = yes ]; then
echo -n " idmapd"
checkproc $IDMAPD_BIN
rc_status -v
fi
echo -n " mountd"
checkproc /usr/sbin/rpc.mountd
rc_status -v
echo -n " statd"
checkproc /usr/sbin/rpc.statd
rc_status -v
echo -n " nfsd"
checkproc -n nfsd
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
exit 1
;;
esac
rc_exit

23
nfsserver.service Normal file
View File

@ -0,0 +1,23 @@
[Unit]
Description=Alias for NFS server
# The systemd alias mechanism (using symlinks) isn't rich enough.
# If you "systemctl enable" an alias, it doesn't enable the
# target.
# This service file creates a sufficiently rich alias for nfs-server
# (which is the canonical upstream name)
# "start", "stop", "restart", "reload" on this will do the same to nfs-server.
# "enable" on this will only enable this service, but when it starts, that
# starts nfs-server, so it is effectively enabled.
# nfs-server.d/nfsserver.conf is part of this service.
Requires= nfs-server.service
PropagatesReloadTo=nfs-server.service
[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -1,20 +0,0 @@
1/ use correct patch for systemctl
2/ use correct name for rpc-statd.service
---
utils/statd/start-statd | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- nfs-utils-1.3.0.orig/utils/statd/start-statd
+++ nfs-utils-1.3.0/utils/statd/start-statd
@@ -4,8 +4,8 @@
# /var/run/rpc.statd.pid).
# It should run statd with whatever flags are apropriate for this
# site.
-PATH=/sbin:/usr/sbin
-if systemctl start statd.service
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+if systemctl start rpc-statd.service
then :
else
exec rpc.statd --no-notify