Clean up lockd configuration

Configuring lockd to listen on a particular set of ports has always been
an iffy proposition. We've tried for years to set it up so that you can
configure it via /etc/sysconfig/nfs, but there are some cases where it
may not get configured properly.

If lockd is started via an nfs mount prior to starting the
nfs-lock.service then it'll end up listening on a random, ephemeral port
instead of the one configured.

Instead of trying to do this, let's formally deprecate the LOCKD_TCPPORT
and LOCKD_UDPPORT parameters in /etc/sysconfig/nfs. The version of it
doesn't even have commented out versions of them anyway. Replace them
with a note that tells admins that they should set up static ports in
/etc/modprobe.d/lockd.conf.

Add an /etc/modprobe.d/lockd.conf with a commented out options directive
to make it easy for them to do so.

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
This commit is contained in:
Jeff Layton 2014-07-16 10:40:37 -04:00 committed by Steve Dickson
parent b9e6f8ca02
commit 8a88dcd324
5 changed files with 19 additions and 22 deletions

7
lockd.conf Normal file
View File

@ -0,0 +1,7 @@
#
# To be installed in /etc/modprobe.d
#
# Those who have need for lockd to listen on a particular port should
# uncomment the line below and set the values appropriately.
#
#options lockd nlm_tcpport=32803 nlm_udpport=32769

View File

@ -1,17 +0,0 @@
#!/bin/sh
. /etc/sysconfig/nfs
# Make sure lockd is loaded
/sbin/modprobe -q lockd $LOCKDARG
# See if the kernel lockd should start up
# listening on a particular port
#
if [ -n "$LOCKD_TCPPORT" ]; then
/sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
fi
if [ -n "$LOCKD_UDPPORT" ]; then
/sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
fi

View File

@ -8,10 +8,7 @@ Before=remote-fs-pre.target
Type=forking
StandardError=syslog+console
EnvironmentFile=-/etc/sysconfig/nfs
ExecStartPre=/usr/libexec/nfs-utils/scripts/nfs-lock.preconfig
ExecStart=/sbin/rpc.statd $STATDARG
# Make sure lockd's ports are reset
ExecStopPost=-/sbin/sysctl -w fs.nfs.nlm_tcpport=0 fs.nfs.nlm_udpport=0
[Install]
WantedBy=nfs.target

View File

@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
Name: nfs-utils
URL: http://sourceforge.net/projects/nfs
Version: 1.3.0
Release: 3.0%{?dist}
Release: 4.0%{?dist}
Epoch: 1
# group all 32bit related archs
@ -13,6 +13,7 @@ Source0: https://www.kernel.org/pub/linux/utils/nfs-utils/%{version}/%{name}-%{v
Source1: id_resolver.conf
Source2: nfs.sysconfig
Source3: nfs-utils_env.sh
Source4: lockd.conf
Patch001: nfs-utils-1.3.1-rc2.patch
@ -115,7 +116,7 @@ mkdir -p $RPM_BUILD_ROOT%{_unitdir}/nfs.target.wants
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man8
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/request-key.d
mkdir -p $RPM_BUILD_ROOT/lib/modprobe.d/
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/
make DESTDIR=$RPM_BUILD_ROOT install
install -s -m 755 tools/rpcdebug/rpcdebug $RPM_BUILD_ROOT%{_sbindir}
install -m 644 utils/mount/nfsmount.conf $RPM_BUILD_ROOT%{_sysconfdir}
@ -135,6 +136,7 @@ done
mkdir -p $RPM_BUILD_ROOT/run/sysconfig
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/scripts
install -m 755 %{SOURCE3} $RPM_BUILD_ROOT/usr/lib/systemd/scripts/nfs-utils_env.sh
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/lockd.conf
#
# For backwards compatablity
@ -245,6 +247,7 @@ fi
%config(noreplace) %{_sharedstatedir}/nfs/etab
%config(noreplace) %{_sharedstatedir}/nfs/rmtab
%config(noreplace) %{_sysconfdir}/request-key.d/id_resolver.conf
%config(noreplace) %{_sysconfdir}/modprobe.d/lockd.conf
%doc linux-nfs/ChangeLog linux-nfs/KNOWNBUGS linux-nfs/NEW linux-nfs/README
%doc linux-nfs/THANKS linux-nfs/TODO
/sbin/rpc.statd
@ -275,6 +278,9 @@ fi
/sbin/umount.nfs4
%changelog
* Tue Jul 01 2014 Jeff Layton <jlayton@primarydata.com> - 1:1.3.0-4.0
- clean up lockd configuration
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:1.3.0-3.0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

View File

@ -1,4 +1,8 @@
#
# NOTE: the LOCKD_TCPPORT and LOCKD_UDPPORT parameters in this file are
# now deprecated. Those that need lockd to listen on a particular
# set of ports should configure /etc/modprobe.d/lockd.conf to do so.
#
# Optinal options passed to rquotad
RPCRQUOTADOPTS=""
#