From 8a88dcd324f16d9211d76de95e7f5f3756dfe417 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Wed, 16 Jul 2014 10:40:37 -0400 Subject: [PATCH] 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 Signed-off-by: Steve Dickson --- lockd.conf | 7 +++++++ nfs-lock.preconfig | 17 ----------------- nfs-lock.service | 3 --- nfs-utils.spec | 10 ++++++++-- nfs.sysconfig | 4 ++++ 5 files changed, 19 insertions(+), 22 deletions(-) create mode 100644 lockd.conf delete mode 100644 nfs-lock.preconfig diff --git a/lockd.conf b/lockd.conf new file mode 100644 index 0000000..a77d72a --- /dev/null +++ b/lockd.conf @@ -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 diff --git a/nfs-lock.preconfig b/nfs-lock.preconfig deleted file mode 100644 index dbd6965..0000000 --- a/nfs-lock.preconfig +++ /dev/null @@ -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 - diff --git a/nfs-lock.service b/nfs-lock.service index d5f0a99..f9bb3e5 100644 --- a/nfs-lock.service +++ b/nfs-lock.service @@ -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 diff --git a/nfs-utils.spec b/nfs-utils.spec index 81621ec..c1a6799 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -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 - 1:1.3.0-4.0 +- clean up lockd configuration + * Sat Jun 07 2014 Fedora Release Engineering - 1:1.3.0-3.0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild diff --git a/nfs.sysconfig b/nfs.sysconfig index 099b897..da4e3da 100644 --- a/nfs.sysconfig +++ b/nfs.sysconfig @@ -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="" #