Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1496822

Summary: mount.nfs calls mount() with nfsvers setting from nfsmount.conf appended to version specified on command line
Product: Red Hat Enterprise Linux 7 Reporter: Frank Sorenson <fsorenso>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: ajmitchell, dwysocha, jiyin, steved, xzhou, yoyang, zlang
Target Milestone: rcKeywords: Patch, Regression, TestCaseProvided
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nfs-utils-1.3.0-0.50.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 18:21:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1420851, 1469559    

Description Frank Sorenson 2017-09-28 13:28:27 UTC
Description of problem:

When the 'nfsvers=' configuration setting is present in the /etc/nfsmount.conf file, calling mount.nfs with an nfs version specified will result in mount.nfs calling mount() with the version from nfsmount.conf appended to the option provided to mount.nfs.


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



How reproducible:

see below


Steps to Reproduce:

    create or set the nfsvers= line in /etc/nfsmount.conf

    call mount with a version specified as an option


Actual results:

mount() syscall is made with 'nfsvers' configuration option appended

  # egrep -i ^nfsvers /etc/nfsmount.conf
  Nfsvers=4

  # mount -vvvv -t nfs nfsserver:/exports /mnt/tmp -o vers=3
  mount.nfs: timeout set for Thu Sep 28 08:07:48 2017
  mount.nfs: trying text-based options 'vers=3,nfsvers=4,addr=192.168.122.72'
  mount.nfs: prog 100003, trying vers=3, prot=6
  mount.nfs: trying 192.168.122.72 prog 100003 vers 3 prot TCP port 2049
  mount.nfs: prog 100005, trying vers=3, prot=17
  mount.nfs: trying 192.168.122.72 prog 100005 vers 3 prot UDP port 20048


  # egrep -i ^nfsvers /etc/nfsmount.conf
  Nfsvers=3

  # strace -qfttTvys 1024 -etrace=mount mount -vvvv -t nfs nfsserver:/exports /mnt/tmp -o vers=4.0
  mount.nfs: timeout set for Thu Sep 28 08:20:34 2017
  mount.nfs: trying text-based options 'vers=4.0,nfsvers=3,addr=192.168.122.72,clientaddr=192.168.122.73'
  [pid 10451] 08:18:34.233533 mount("nfsserver:/exports", "/mnt/tmp", "nfs", 0, "vers=4.0,nfsvers=3,addr=192.168.122.72,clientaddr=192.168.122.73") = 0 <0.010063>

  # grep nfsserver /proc/mounts
  nfsserver:/exports /mnt/tmp nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.122.72,mountvers=3,mountproto=tcp,local_lock=none,addr=192.168.122.72 0 0


  # egrep -i ^nfsvers /etc/nfsmount.conf
  Nfsvers=3

  # strace -qfttTvys 1024 -etrace=mount mount -vvvv -t nfs nfsserver:/exports /mnt/tmp -o vers=4.1
  mount.nfs: timeout set for Thu Sep 28 08:21:59 2017
  mount.nfs: trying text-based options 'vers=4.1,nfsvers=3,addr=192.168.122.72,clientaddr=192.168.122.73'
  [pid 10492] 08:19:59.288583 mount("nfsserver:/exports", "/mnt/tmp", "nfs", 0, "vers=4.1,nfsvers=3,addr=192.168.122.72,clientaddr=192.168.122.73") = -1 EINVAL (Invalid argument) <0.002484>
  mount.nfs: mount(2): Invalid argument
  mount.nfs: an incorrect mount option was specified
  [pid 10492] 08:19:59.293117 +++ exited with 32 +++


Expected results:

  version specified as command-line option overrides default options in nfsmount.conf, and only one version is provided in the call to mount()


Additional info:

Comment 4 Yongcheng Yang 2017-09-29 00:45:38 UTC
This problem also exists in Fedora 26.

Looks like it only occurs when specifying the minor version
while it can parse successfully with "-o vers=4" or "-t nfs4"

[root@fedora26 ~]# cat /etc/redhat-release 
Fedora release 26 (Twenty Six)
[root@fedora26 ~]# rpm -q nfs-utils
nfs-utils-2.1.1-5.rc5.fc26.x86_64
[root@fedora26 ~]# 
[root@fedora26 ~]# egrep -i ^nfsvers /etc/nfsmount.conf
Nfsvers=3
[root@fedora26 ~]# mount -t nfs localhost:/export_test /mnt/ -o vers=4 -vvv
mount.nfs: timeout set for Thu Sep 28 20:35:06 2017
mount.nfs: trying text-based options 'vers=4.2,addr=::1,clientaddr=::1'
[root@fedora26 ~]# cat /proc/mounts | grep mnt
localhost:/export_test /mnt nfs4 rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp6,port=0,timeo=600,retrans=2,sec=sys,clientaddr=::1,local_lock=none,addr=::1 0 0
[root@fedora26 ~]# umount /mnt/
[root@fedora26 ~]# 
################## Reproduced!
[root@fedora26 ~]# mount -t nfs localhost:/export_test /mnt/ -o vers=4.0 -vvv
mount.nfs: timeout set for Thu Sep 28 20:35:28 2017
mount.nfs: trying text-based options 'vers=4.0,nfsvers=3,addr=::1,clientaddr=::1' <<<<<<
[root@fedora26 ~]# cat /proc/mounts | grep mnt
localhost:/export_test /mnt nfs rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp6,timeo=600,retrans=2,sec=sys,mountaddr=::1,mountvers=3,mountproto=tcp6,local_lock=none,addr=::1 0 0
[root@fedora26 ~]# umount /mnt/
[root@fedora26 ~]# mount -t nfs localhost:/export_test /mnt/ -o vers=4.2 -vvv
mount.nfs: timeout set for Thu Sep 28 20:36:08 2017
mount.nfs: trying text-based options 'vers=4.2,nfsvers=3,addr=::1,clientaddr=::1' <<<<<<
mount.nfs: mount(2): Invalid argument
mount.nfs: an incorrect mount option was specified
[root@fedora26 ~]# cat /proc/mounts | grep mnt
[root@fedora26 ~]# cat /proc/fs/nfsd/versions 
-2 +3 +4 +4.1 +4.2
[root@fedora26 ~]#

Comment 5 Alice Mitchell 2017-10-04 10:08:48 UTC
Patch posted upstream http://www.spinics.net/lists/linux-nfs/msg65755.html

Comment 6 Steve Dickson 2017-10-05 14:58:20 UTC
The upstream commit....

commit 8110103404b35d9e86057ef0764f8aa87585f455 
Author: Justin Mitchell <jumitche>
Date:   Thu Oct 5 10:40:51 2017 -0400

    mount.nfs: merge in vers= and nfsvers= options

Comment 8 Yongcheng Yang 2017-10-19 05:54:17 UTC
verified with nfs-utils-1.3.0-0.50.el7
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[01:46:03 root@ ~~]# cat /etc/nfsmount.conf
[ Server "localhost" ]
Nfsvers=3

[01:46:03 root@ ~~]# mount.nfs localhost:/exportDir-nfsmount-conf /mnt/nfsmp-nfsmount-conf -vvv -o vers=3
mount.nfs: trying ::1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: trying ::1 prog 100005 vers 3 prot UDP port 20048
mount.nfs: timeout set for Thu Oct 19 01:48:03 2017
mount.nfs: trying text-based options 'vers=3,addr=::1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: prog 100005, trying vers=3, prot=17
[01:46:03 root@ ~~]# cat /proc/mounts | grep /mnt/nfsmp-nfsmount-conf
localhost:/exportDir-nfsmount-conf /mnt/nfsmp-nfsmount-conf nfs rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp6,timeo=600,retrans=2,sec=sys,mountaddr=::1,mountvers=3,mountport=20048,mountproto=udp6,local_lock=none,addr=::1 0 0
^^^^^^^^^^^^^^^^^^^^^^^^  Mounted with nfsvers 3, expected as 3
[01:46:03 root@ ~~]# umount /mnt/nfsmp-nfsmount-conf

[01:46:03 root@ ~~]# mount.nfs localhost:/exportDir-nfsmount-conf /mnt/nfsmp-nfsmount-conf -vvv -o vers=4.0
mount.nfs: timeout set for Thu Oct 19 01:48:03 2017
mount.nfs: trying text-based options 'vers=4.0,addr=::1,clientaddr=::1'
[01:46:03 root@ ~~]# cat /proc/mounts | grep /mnt/nfsmp-nfsmount-conf
localhost:/exportDir-nfsmount-conf /mnt/nfsmp-nfsmount-conf nfs4 rw,relatime,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp6,port=0,timeo=600,retrans=2,sec=sys,clientaddr=::1,local_lock=none,addr=::1 0 0
^^^^^^^^^^^^^^^^^^^^^^^^^^ Mounted with nfsvers 4.0, expected as 4.0
[01:46:03 root@ ~~]# umount /mnt/nfsmp-nfsmount-conf

[01:46:03 root@ ~~]# mount.nfs localhost:/exportDir-nfsmount-conf /mnt/nfsmp-nfsmount-conf -vvv -o vers=4.1
mount.nfs: timeout set for Thu Oct 19 01:48:03 2017
mount.nfs: trying text-based options 'vers=4.1,addr=::1,clientaddr=::1'
[01:46:03 root@ ~~]# cat /proc/mounts | grep /mnt/nfsmp-nfsmount-conf
localhost:/exportDir-nfsmount-conf /mnt/nfsmp-nfsmount-conf nfs4 rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp6,port=0,timeo=600,retrans=2,sec=sys,clientaddr=::1,local_lock=none,addr=::1 0 0
^^^^^^^^^^^^^^^^^^^^^^^^^^ Mounted with nfsvers 4.1, expected as 4.1
[01:46:03 root@ ~~]# umount /mnt/nfsmp-nfsmount-conf

[01:46:04 root@ ~~]# mount.nfs localhost:/exportDir-nfsmount-conf /mnt/nfsmp-nfsmount-conf -vvv -o vers=4.2
mount.nfs: timeout set for Thu Oct 19 01:48:04 2017
mount.nfs: trying text-based options 'vers=4.2,addr=::1,clientaddr=::1'
[01:46:04 root@ ~~]# cat /proc/mounts | grep /mnt/nfsmp-nfsmount-conf
localhost:/exportDir-nfsmount-conf /mnt/nfsmp-nfsmount-conf nfs4 rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp6,port=0,timeo=600,retrans=2,sec=sys,clientaddr=::1,local_lock=none,addr=::1 0 0
^^^^^^^^^^^^^^^^^^^^^^^^^^ Mounted with nfsvers 4.2, expected as 4.2
[01:46:04 root@ ~~]# umount /mnt/nfsmp-nfsmount-conf

Comment 13 errata-xmlrpc 2018-04-10 18:21:01 UTC
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://access.redhat.com/errata/RHBA-2018:0981