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 1194348

Summary: NFS4 - mp,mountpoint option in /etc/exports offers export when it should not while trying to mount it will be hang
Product: Red Hat Enterprise Linux 7 Reporter: evets brido <hhocolumbus>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED WONTFIX QA Contact: Zhi Li <yieli>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: bgoncalv, jiyin, xzhou, yieli, yoyang
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-12-15 07:33:19 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 evets brido 2015-02-19 15:43:55 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.56 Safari/537.36
Build Identifier: 

NFS4 mp or mountpoint option specified in /etc/exports has no effect, e.g., nfs will export an export point specified as 'mp' even though that export point is not a mountpoint.

Reproducible: Always

Steps to Reproduce:
1.in /etc/exports:
/export       *(fsid=0,ro)
/export/share *(rw,mp)

2.mkdir -p /export/share

3.start or restart nfs service

4. mountpoint -e
   shows /export/share as available

5. from another machine attempt to mount:
   mount server:/share /mnt/share

6. server allows the export and the client mounts the export successfully
Actual Results:  
the directory /export/share is offered by the nfs server as a possible export

Expected Results:  
since /export/share is not a mountpoint, it should not be shared - according to the man page.

1. /export/share should not be listed in output of showmount -e
2. server:/share should not be mountable by any nfs client

The expected behaviour, per the man page, is intended to prevent an underlying nfs export point from being exported in the case that it has not been mounted.

this behaviour traces back to at least rhel 6.0

Comment 2 Yongcheng Yang 2017-07-19 08:11:53 UTC
(In reply to evets brido from comment #0)
> Expected Results:  
> since /export/share is not a mountpoint, it should not be shared -
> according to the man page. - exports(5)
> 
> 1. /export/share should not be listed in output of showmount -e
> 2. server:/share should not be mountable by any nfs client

Just take a simple test in latest RHEL7.  If the directory is
exported as "mp" but actually _not_ an mountpoint (yet):
- 1. It still can be listed by "showmount -e".
- 2. However, the mount operation will be hanged up.

# on server side: export dir as "mp" while it's _not_ an mp (yet)
[root@nfs_server ~]# cat /etc/exports
/export_test *(rw,mountpoint)
[root@nfs_server ~]# systemctl restart nfs
[root@nfs_server ~]# exportfs -v
/export_test  	<world>(rw,sync,wdelay,hide,no_subtree_check,mountpoint,sec=sys,secure,root_squash,no_all_squash)
[root@nfs_server ~]# cat /proc/mounts | grep test
[root@nfs_server ~]# 

# on the client side
[root@nfs_client ~]# showmount -e $nfs_server
Export list for nfs_server:
/export_test *
^^^^^^^^^^^^^^ it can be listed
[root@nfs_client ~]# mount -t nfs4 $nfs_server:/export_test /mnt
^C
[root@nfs_client ~]# mount -t nfs4 $nfs_server:/export_test /mnt -vvv
mount.nfs4: timeout set for Wed Jul 19 03:53:34 2017
mount.nfs4: trying text-based options 'vers=4.1,addr=10.73.194.83,clientaddr=10.73.4.153'
^^^^^^^^^^^^^ mounting hang
^C
[root@nfs_client ~]# 

# on server side: mount the exported dir now
[root@nfs_server ~]# mount /tmp/loop.test.image /export_test/
[root@nfs_server ~]# cat /proc/mounts | grep test
/dev/loop0 /export_test xfs rw,seclabel,relatime,attr2,inode64,noquota 0 0
[root@nfs_server ~]# 

# on client side
[root@nfs_client ~]# mount -t nfs4 nfs_server.rhts.eng.pek2.redhat.com:/export_test /mnt -vvv
mount.nfs4: timeout set for Wed Jul 19 03:54:20 2017
mount.nfs4: trying text-based options 'vers=4.1,addr=10.73.194.83,clientaddr=10.73.4.153'
[root@nfs_client ~]# nfsstat -m
/mnt from nfs_server.rhts.eng.pek2.redhat.com:/export_test
 Flags:	rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.73.4.153,local_lock=none,addr=10.73.194.83

[root@nfs_client ~]# umount /mnt/
[root@nfs_client ~]#

Comment 4 Yongcheng Yang 2017-10-17 08:47:22 UTC
As Bug 1490935 comment #2 says, the export can be showed up.
But trying to mount the mount point should get failed.

But operation "mount" gets hang in RHEL, which should be a problem.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@ ~~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.4 (Maipo)
[root@ ~~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.48.el7.x86_64
[root@ ~~]# 
[root@ ~~]# exportfs -i *:/expdir-exportfs_share -o mp
[root@ ~~]# exportfs -v
/expdir-exportfs_share
                <world>(ro,sync,wdelay,hide,no_subtree_check,mountpoint,sec=sys,secure,root_squash,no_all_squash)
[root@ ~~]# mountpoint /expdir-exportfs_share
/expdir-exportfs_share is not a mountpoint
[root@ ~~]# showmount -e | grep share
/expdir-exportfs_share *
[root@ ~~]# timeout 60 mount localhost:/expdir-exportfs_share /mnt/nfsmp-exportfs
[root@ ~~]# echo $?
124
^^^ about "mount" hang for more than 60 seconds


Compared with Fedora26:
~~~~~~~~~~~~~~~~~~~~~~
[root@ ~~]# cat /etc/redhat-release 
Fedora release 26 (Twenty Six)
[root@ ~~]# rpm -q nfs-utils
nfs-utils-2.1.1-5.rc5.fc26.x86_64
[root@ ~~]# 
...
[root@ ~~]# mountpoint /expdir-exportfs_share
/expdir-exportfs_share is not a mountpoint
[root@ ~~]# showmount -e | grep share
/expdir-exportfs_share *
[root@ ~~]# timeout 60 mount localhost:/expdir-exportfs_share /mnt/nfsmp-exportfs
mount.nfs: mounting localhost:/expdir-exportfs_share failed, reason given by server: No such file or directory
[root@ ~~]# echo $?
32


Looks like we miss one or more patched with upstream.

Comment 5 Yongcheng Yang 2017-12-07 03:09:14 UTC
*** Bug 1401825 has been marked as a duplicate of this bug. ***

Comment 7 RHEL Program Management 2020-12-15 07:33:19 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.