Bug 441983

Summary: nfs server does not correctly set parameters on first startup
Product: Red Hat Enterprise Linux 5 Reporter: Brendan Lynch <brendanplynch>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 5.1CC: johnw, tomek
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-01-20 21:01:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brendan Lynch 2008-04-11 02:02:16 UTC
Description of problem:

This problem manifested itself when we tried to access RHEL5 NFS server boxes
from Solaris 10 "/net" automount clients.  To avoid the issues with the
different NFSv4 filesystem namespaces shown by Solaris and Linux we tried to
disable NFSv4 (as we used to do with RHEL4) by adding a parameter:

RPCNFSDARGS="--no-nfs-version 4"

to the /etc/sysconfig/nfs file.  We were surpised when it did not seem to work;
even more surprised when sometimes it DID seem to work.

After further debugging we found that immediately after boot nfs4 was always
enabled if the nfs service was started, irrespective of the RPCNFSDARGS
parameter; if the nfs service was restarted, or stopped and started without
reboot, the RPCNFSDARGS parameter was obeyed.

Further investigation suggested that the reason was that the "nfsd" utility
process tried to pass the version (and port numbers if specified) parameters to
the kernel nfsd service via the /proc/fs/nfsd/xxx interface before starting the
nfsd kernel service, but since the service was not yet started the /proc/fs/nfsd
interface namespace was not yet populated.  An strace of the nfsd utility reads:

3104  open("/proc/fs/nfsd/versions", O_WRONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory)
3104  open("/proc/fs/nfsd/portlist", O_WRONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory)
3104  open("/proc/fs/nfsd/threads", O_WRONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory)
3104  open("/proc/fs/nfs/threads", O_WRONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory)
3104  nfsservctl(0, 0xbff160d0, 0)      = 0

When the nfs service is shutdown and restarted, the /proc/fs/nfsd namespace
exists and evrything works:

2999  open("/proc/fs/nfsd/versions", O_WRONLY|O_LARGEFILE) = 4
2999  write(4, "+2 +3 -4 \n", 10)       = 10
2999  close(4)                          = 0
2999  open("/proc/fs/nfsd/portlist", O_WRONLY|O_LARGEFILE) = 4
2999  socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 5
2999  bind(5, {sa_family=AF_INET, sin_port=htons(2049),
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
2999  socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 6
2999  setsockopt(6, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
2999  bind(6, {sa_family=AF_INET, sin_port=htons(2049),
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
2999  listen(6, 64)                     = 0
2999  write(4, "5\n", 2)                = 2
2999  close(4)                          = 0
2999  open("/proc/fs/nfsd/portlist", O_WRONLY|O_LARGEFILE) = 4
2999  write(4, "6\n", 2)                = 2
2999  close(4)                          = 0
2999  open("/proc/fs/nfsd/threads", O_WRONLY|O_LARGEFILE) = 4
2999  write(4, "3\n", 2)                = 2
2999  close(4)                          = 0

Although we have not encountered symptoms of it in our usage, analysis of the
first trace output suggests that the portlist parameters will also be ignored on
first nfs service start after boot.



Version-Release number of selected component (if applicable):

The following combinations all show this problem:

nfs-utils-1.0.9-16.el5
kernel-2.6.18-8.el5

nfs-utils-1.0.9-24.el5
kernel-2.6.18-53.1.14.el5

nfs-utils-1.1.0-6.fc8
kernel-2.6.24.4-64.fc8

How reproducible:


Steps to Reproduce:
1. Set parameter
        RPCNFSDARGS="--no-nfs-version 4"
   in /etc/sysconfig/nfs
2. Set /etc/exportfs to export an nfs partition.
3. Enable nfs server services
4. Reboot the system
5. Note that NFSv4 is enabled (cat /proc/fs/nfsd/versions and rpcinfo -p both
show nfs4 enabled)
6. Restart nfs service with "service nfs restart"
7 both "cat /proc/fs/nfsd/versions" and "rpcinfo -p" will now show nfs4 disabled.

  
Actual results:


Expected results:


Additional info:

Comment 1 Brendan Lynch 2008-04-28 17:34:11 UTC
*** Bug 249600 has been marked as a duplicate of this bug. ***

Comment 2 Brendan Lynch 2008-04-29 23:02:33 UTC
If the "nfsd" module is loaded into the kernel by modprobe before the nfs
service is started the problem goes away.  The following output is from a
session just after boot, with the nfs service disabled (so it has to be manually
started) and the "--no-nfs-version4" parameter specified in /etc/sysconfig/nfs .

As is obvious, before the modprobe of nfsd the /proc/fs/nfsd namespace is empty;
after it the namespace is populated and the driver parameter setting works.

This is on an fc8 system with the latest released kernel.

# ls -l /proc/fs/nfsd
total 0

# modprobe -v nfsd
insmod /lib/modules/2.6.24.4-64.fc8/kernel/fs/exportfs/exportfs.ko 
insmod /lib/modules/2.6.24.4-64.fc8/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko 
insmod /lib/modules/2.6.24.4-64.fc8/kernel/fs/nfs_common/nfs_acl.ko 
insmod /lib/modules/2.6.24.4-64.fc8/kernel/fs/lockd/lockd.ko 
install /sbin/modprobe --first-time --ignore-install nfsd && { /bin/mount -t
nfsd nfsd /proc/fs/nfsd > /dev/null 2>&1 || :; }
insmod /lib/modules/2.6.24.4-64.fc8/kernel/fs/nfsd/nfsd.ko 

# ls -l /proc/fs/nfsd
total 0
-r--r--r-- 1 root root 0 2008-04-29 18:59 exports
-rw------- 1 root root 0 2008-04-29 18:59 filehandle
-rw-r--r-- 1 root root 0 2008-04-29 18:59 max_block_size
-rw------- 1 root root 0 2008-04-29 18:59 nfsv4leasetime
-rw------- 1 root root 0 2008-04-29 18:59 nfsv4recoverydir
-rw------- 1 root root 0 2008-04-29 18:59 pool_threads
-rw-r--r-- 1 root root 0 2008-04-29 18:59 portlist
-rw------- 1 root root 0 2008-04-29 18:59 threads
-rw------- 1 root root 0 2008-04-29 18:59 versions


# rpcinfo -p
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100000    4     0    111  portmapper
    100000    3     0    111  portmapper
    100000    2     0    111  portmapper
    100024    1   udp  58293  status
    100024    1   tcp  48666  status

# service nfs start
                                                           [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]

# rpcinfo -p
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100000    4     0    111  portmapper
    100000    3     0    111  portmapper
    100000    2     0    111  portmapper
    100024    1   udp  58293  status
    100024    1   tcp  48666  status
    100011    1   udp    691  rquotad
    100011    2   udp    691  rquotad
    100011    1   tcp    694  rquotad
    100011    2   tcp    694  rquotad
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100021    1   udp  48537  nlockmgr
    100021    3   udp  48537  nlockmgr
    100021    4   udp  48537  nlockmgr
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100021    1   tcp  35523  nlockmgr
    100021    3   tcp  35523  nlockmgr
    100021    4   tcp  35523  nlockmgr
    100005    1   udp  52758  mountd
    100005    1   tcp  53965  mountd
    100005    2   udp  52758  mountd
    100005    2   tcp  53965  mountd
    100005    3   udp  52758  mountd
    100005    3   tcp  53965  mountd


Comment 3 RHEL Program Management 2008-06-02 20:07:56 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 5 Steve Dickson 2008-09-18 11:50:03 UTC
fixed in nfs-utils-1.0.9-36.el5

Comment 9 errata-xmlrpc 2009-01-20 21:01:52 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2009-0107.html