Bug 441983 - nfs server does not correctly set parameters on first startup
nfs server does not correctly set parameters on first startup
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: nfs-utils (Show other bugs)
5.1
All Linux
low Severity medium
: rc
: ---
Assigned To: Steve Dickson
:
: 249600 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-10 22:02 EDT by Brendan Lynch
Modified: 2009-01-20 16:01 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-01-20 16:01:52 EST
Type: ---
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 Brendan Lynch 2008-04-10 22:02:16 EDT
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 13:34:11 EDT
*** Bug 249600 has been marked as a duplicate of this bug. ***
Comment 2 Brendan Lynch 2008-04-29 19:02:33 EDT
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 Product and Program Management 2008-06-02 16:07:56 EDT
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 07:50:03 EDT
fixed in nfs-utils-1.0.9-36.el5
Comment 9 errata-xmlrpc 2009-01-20 16:01:52 EST
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

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