Bug 1264387 - change to use lockd.conf instead of sysconfig to set module lockd parameters
change to use lockd.conf instead of sysconfig to set module lockd parameters
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: nfs-utils (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Steve Dickson
Yongcheng Yang
: Documentation
: 1247089 (view as bug list)
Depends On:
Blocks: 1355652
  Show dependency treegraph
 
Reported: 2015-09-18 06:40 EDT by Yongcheng Yang
Modified: 2017-05-29 08:59 EDT (History)
4 users (show)

See Also:
Fixed In Version: nfs-utils-1.3.0-0.28.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-04 01:00:20 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Yongcheng Yang 2015-09-18 06:40:56 EDT
Description of problem:
Change the value of LOCKDARG in /etc/sysconfig/nfs and then restart nfs-config.service. It seems that the arguments setting of LOCKDARG doesn't take effect.
Even rebooting the machine cannot change the lockd setting neither. Maybe during the booting it has load it by a default setting.
The lockd is a kernel module, we can only change it by unload and reload the lockd module. But how can we define the arguments?

So is LOCKDARG in /etc/sysconfig/nfs useless, or the method to load it is with some problem?
Seems the following code of /usr/lib/systemd/scripts/nfs-utils_env.sh seems never works:
[root@hp-dl380pg8-01 ~]# cat /usr/lib/systemd/scripts/nfs-utils_env.sh 
...
[ -n "$LOCKDARG" ] && /sbin/modprobe lockd $LOCKDARG
if [ -n "$LOCKD_TCPPORT" -o -n "$LOCKD_UDPPORT" ]; then
	[ -z "$LOCKDARG" ] && /sbin/modprobe lockd $LOCKDARG
	<snip>
fi
...

Version-Release number of selected component (if applicable):
nfs-utils-1.3.0-0.20.el7

How reproducible:
100%

Steps to Reproduce:
1. echo LOCKDARG="nsm_use_hostnames=1" > /etc/sysconfig/nfs
2. service nfs-config restart or just reboot
3. sysctl fs.nfs.nsm_use_hostnames
or "cat /sys/module/lockd/parameters/nsm_use_hostnames"

Actual results:
[root@hp-dl380pg8-01 ~]# grep '.*' -r /sys/module/lockd/parameters/
/sys/module/lockd/parameters/nlm_grace_period:0
/sys/module/lockd/parameters/nlm_tcpport:48888
/sys/module/lockd/parameters/nlm_max_connections:1111 <<<<<<<<<<<<<<<<
/sys/module/lockd/parameters/nlm_timeout:10
/sys/module/lockd/parameters/nsm_use_hostnames:N <<<<<<<<<<<<<<<<<<<<<
/sys/module/lockd/parameters/nlm_udpport:46666
[root@hp-dl380pg8-01 ~]# vi /etc/sysconfig/nfs
[root@hp-dl380pg8-01 ~]# cat /etc/sysconfig/nfs
# Optional arguments passed to in-kernel lockd
LOCKDARG="nsm_use_hostnames=1 nlm_max_connections=1234"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Cannot take effect
LOCKD_TCPPORT=23456
LOCKD_UDPPORT=65432
[root@hp-dl380pg8-01 ~]# service nfs-config restart
Redirecting to /bin/systemctl restart  nfs-config.service
[root@hp-dl380pg8-01 ~]# grep '.*' -r /sys/module/lockd/parameters/
/sys/module/lockd/parameters/nlm_grace_period:0
/sys/module/lockd/parameters/nlm_tcpport:23456
/sys/module/lockd/parameters/nlm_max_connections:1111 <<<<<<<<<<<<<<<
/sys/module/lockd/parameters/nlm_timeout:10
/sys/module/lockd/parameters/nsm_use_hostnames:N <<<<<<<<<<<<<<<<<<<<
/sys/module/lockd/parameters/nlm_udpport:65432
[root@hp-dl380pg8-01 ~]# 

Expected results:
Use "LOCKDARG" to define lockd arguments

Additional info:
The LOCKD_TCPPORT/LOCKD_UDPPORT in /etc/sysconfig/nfs can work
Comment 4 Steve Dickson 2015-09-30 07:26:32 EDT
I think this because proc-fs-nfsd.mount actually loading 
the lockd module and that service does not look at
the variables in /etc/sysconfig/nfs... 

Since there are other ways to set module parameters, let
look into this in 7.3
Comment 11 Steve Dickson 2016-05-16 10:43:52 EDT
With this commit the following sysconfig/nfs lockd interface 
# Optional arguments passed to in-kernel lockd
LOCKDARG="nsm_use_hostnames=1"
# TCP port rpc.lockd should listen on.
#LOCKD_TCPPORT=32803
# UDP port rpc.lockd should listen on.
#LOCKD_UDPPORT=32769
#

No longer exists, since they never worked. This interface
has been replaced by the /etc/modprobe.d/lock.conf interface
#
# Set the NFS lock manager grace period. n is measured in seconds. 
#options lockd nlm_grace_period=90
#
# Set the TCP port that the NFS lock manager should use. 
# port must be a valid TCP port value (1-65535).
#options lockd nlm_tcpport
#
# Set the UDP port that the NFS lock manager should use.
# port must be a valid UDP port value (1-65535).
#options lockd nlm_udpport
#
# Set the maximum number of outstanding connections 
#options lockd nlm_max_connections=1024
#
# Set the default time value for the NFS lock manager
# in seconds. Default is 10 secs
#options lockd nlm_timeout=10
#
# Choose whether to record the caller_name or IP address
# this peer in the local rpc.statd's database.
#options lockd nsm_use_hostnames=0


If the old lockd interface was document (which I could not find)
then it has to change to reflex new interface.
Comment 15 Yongcheng Yang 2016-05-27 05:42:14 EDT
Move to VERIFIED according to comment 14 and continue to run the automatic case.
Comment 16 Yongcheng Yang 2016-06-02 03:08:14 EDT
Seems cannot set the parameter "nlm_timeout" bigger than 20 While testing the new lockd.conf, and i still not find any explanation in man page or usage.

Hi Steve, does this action all right? And do we need to add some description about this limitation?

[root@hp-dl385pg8-08 ~]# echo "options lockd nlm_timeout=21" >/etc/modprobe.d/lockd.conf
[root@hp-dl385pg8-08 ~]# systemctl stop  nfs.service
[root@hp-dl385pg8-08 ~]# systemctl stop  rpc-gssd.service
[root@hp-dl385pg8-08 ~]# umount /proc/fs/nfsd
[root@hp-dl385pg8-08 ~]# modprobe -r nfsd
[root@hp-dl385pg8-08 ~]# modprobe -r lockd
modprobe: FATAL: Module lockd is in use.
[root@hp-dl385pg8-08 ~]# modprobe -r nfs
modprobe: FATAL: Module nfs is in use.
[root@hp-dl385pg8-08 ~]# modprobe -r nfsv4
[root@hp-dl385pg8-08 ~]# modprobe -r nfsv3
[root@hp-dl385pg8-08 ~]# modprobe -r nfs
[root@hp-dl385pg8-08 ~]# modprobe -r lockd
[root@hp-dl385pg8-08 ~]# lsmod | grep lockd
[root@hp-dl385pg8-08 ~]# systemctl start  nfs.service
A dependency job for nfs-server.service failed. See 'journalctl -xe' for details.
[root@hp-dl385pg8-08 ~]# systemctl status nfs.service -l
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: inactive (dead) since Thu 2016-06-02 02:42:45 EDT; 2min 42s ago
  Process: 21751 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 21748 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 21744 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 21494 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 21491 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 21494 (code=exited, status=0/SUCCESS)

Jun 01 22:16:30 hp-dl385pg8-08.rhts.eng.pek2.redhat.com systemd[1]: Starting NFS server and services...
Jun 01 22:16:30 hp-dl385pg8-08.rhts.eng.pek2.redhat.com systemd[1]: Started NFS server and services.
Jun 02 02:42:45 hp-dl385pg8-08.rhts.eng.pek2.redhat.com systemd[1]: Stopping NFS server and services...
Jun 02 02:42:45 hp-dl385pg8-08.rhts.eng.pek2.redhat.com systemd[1]: Stopped NFS server and services.
Jun 02 02:45:16 hp-dl385pg8-08.rhts.eng.pek2.redhat.com systemd[1]: Dependency failed for NFS server and services.
Jun 02 02:45:16 hp-dl385pg8-08.rhts.eng.pek2.redhat.com systemd[1]: Job nfs-server.service/start failed with result 'dependency'.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  Failed if nlm_timeout > 20
[root@hp-dl385pg8-08 ~]# cat /etc/modprobe.d/lockd.conf
options lockd nlm_timeout=21
[root@hp-dl385pg8-08 ~]# echo "options lockd nlm_timeout=20" >/etc/modprobe.d/lockd.conf
[root@hp-dl385pg8-08 ~]# cat /etc/modprobe.d/lockd.conf
options lockd nlm_timeout=20
[root@hp-dl385pg8-08 ~]# systemctl start  nfs.service
[root@hp-dl385pg8-08 ~]# systemctl status nfs.service
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled)
   Active: active (exited) since Thu 2016-06-02 02:47:14 EDT; 5s ago
  Process: 21751 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 21748 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 21744 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 21827 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 21825 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 21827 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Jun 02 02:47:14 hp-dl385pg8-08.rhts.eng.pek2.redhat.com systemd[1]: Starting NFS server and services...
Jun 02 02:47:14 hp-dl385pg8-08.rhts.eng.pek2.redhat.com systemd[1]: Started NFS server and services.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  Success if nlm_timeout <= 20
[root@hp-dl385pg8-08 ~]# cat /sys/module/lockd/parameters/nlm_timeout 
20
[root@hp-dl385pg8-08 ~]#
Comment 17 Steve Dickson 2016-06-06 11:03:31 EDT
(In reply to Yongcheng Yang from comment #16)
> Seems cannot set the parameter "nlm_timeout" bigger than 20 While testing
> the new lockd.conf, and i still not find any explanation in man page or
> usage.
> 
> Hi Steve, does this action all right? And do we need to add some description
> about this limitation?
> 
Yes this does make sense... with the sysctl kernel interface there
are min and max constants that need to be provided.

For nlm_timeout the min and max constants are 3 and 20. 
So that is why you can't set the timeout over 30.
Comment 18 Yongcheng Yang 2016-06-07 00:13:09 EDT
(In reply to Steve Dickson from comment #17)
> (In reply to Yongcheng Yang from comment #16)
> > Seems cannot set the parameter "nlm_timeout" bigger than 20 While testing
> > the new lockd.conf, and i still not find any explanation in man page or
> > usage.
> > 
> > Hi Steve, does this action all right? And do we need to add some description
> > about this limitation?
> > 
> Yes this does make sense... with the sysctl kernel interface there
> are min and max constants that need to be provided.
> 
> For nlm_timeout the min and max constants are 3 and 20. 
> So that is why you can't set the timeout over 30.

Thanks for the clarification. It's better to add some explanation in the file /etc/modprobe.d/lockd.conf, like what "nlm_tcpport" does.

# Set the TCP port that the NFS lock manager should use. 
# port must be a valid TCP port value (1-65535). <<<<<<<<<<
#options lockd nlm_tcpport
...
# Set the default time value for the NFS lock manager
# in seconds. Default is 10 secs
#options lockd nlm_timeout=10
Comment 19 Steve Dickson 2016-06-07 09:59:22 EDT
(In reply to Yongcheng Yang from comment #18)
> 
> Thanks for the clarification. It's better to add some explanation in the
> file /etc/modprobe.d/lockd.conf, like what "nlm_tcpport" does.
> 
> # Set the TCP port that the NFS lock manager should use. 
> # port must be a valid TCP port value (1-65535). <<<<<<<<<<
> #options lockd nlm_tcpport
> ...
> # Set the default time value for the NFS lock manager
> # in seconds. Default is 10 secs
> #options lockd nlm_timeout=10
Yeah... that's probably not a bad idea...

I'll move this bz back to ON_QA when I make the change.
Comment 20 Steve Dickson 2016-06-07 14:01:05 EDT
*** Bug 1247089 has been marked as a duplicate of this bug. ***
Comment 21 Yongcheng Yang 2016-06-08 03:58:05 EDT
Checked the update mentioned in comment 19 with nfs-utils-1.3.0-0.28.el7

[root@ibm-x3250m4-07 ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.28.el7.x86_64
[root@ibm-x3250m4-07 ~]# cat /etc/modprobe.d/lockd.conf 
[snip ...]
# Set the default time value for the NFS lock manager
# in seconds. Default is 10 secs (min 3 max 20)
#options lockd nlm_timeout=10
[snip ...]
[root@ibm-x3250m4-07 ~]# 

Move to VERIFIED (again) as comment 14 and continue to run the automatic case.
Comment 23 errata-xmlrpc 2016-11-04 01:00:20 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2383.html

Note You need to log in before you can comment on or make changes to this bug.