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 1437190 - nfs-server-generator: handle 'noauto' mounts correctly.
Summary: nfs-server-generator: handle 'noauto' mounts correctly.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: nfs-utils
Version: 7.4
Hardware: All
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Steve Dickson
QA Contact: ChunYu Wang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-29 17:34 UTC by ChunYu Wang
Modified: 2017-08-01 19:50 UTC (History)
4 users (show)

Fixed In Version: nfs-utils-1.3.0-0.39.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 19:50:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2233 0 normal SHIPPED_LIVE nfs-utils bug fix and enhancement update 2017-08-01 18:19:33 UTC

Description ChunYu Wang 2017-03-29 17:34:06 UTC
Description of problem:
Upstream nfs-utils has just fixed a conflict area on systemd behavior, maybe we also need to fix it on nfs-utils.el7: 

By reading systemd.unit man pages, dependency opinion 'RequiresMountsFor= /path/to/mount_point' will handle mount point marked with 'noauto' as:

           Mount points marked with noauto are not mounted
           automatically and will be ignored for the purposes of
           this option. If such a mount should be a requirement for
           this unit, direct dependencies on the mount units may be
           added (Requires= and After= or some other combination).

But on rhel-7, the 'noauto' mount point will be mounted automatically by starting nfs-server.service with 'RequiresMountsFor= /path/to/mount_point' set:

[root@~ /]# umount /home
[root@~ /]# cat /etc/fstab |grep noauto
/dev/mapper/rhel_-home /home                   xfs     noauto        0 0
^^^ Set mount flag into noauto
[root@~ /]# mount -a
[root@~ /]# mountpoint /home/
/home/ is not a mountpoint
[root@~ /]# cat /lib/systemd/system/nfs-server.service |grep RequiresMountsFor
RequiresMountsFor= /home
^^^ Set 'RequiresMountsFor= /path/to/mount_point'
[root@~ /]# systemctl restart nfs-server
[root@~ /]# mountpoint /home/
/home/ is a mountpoint
^^^ Start nfs-server will mount it as requirement
[root@~ /]# mount |grep home
/dev/mapper/rhel_-home on /home type xfs (rw,relatime,seclabel,attr2,inode64,noquota)

How reproducible:
100%

Comment 2 ChunYu Wang 2017-03-29 17:35:29 UTC
Upstream patch:

commit 40346e1503c3d52b43ed3fe2bf56742ac5454553
Author: NeilBrown <neilb>
Date:   Wed Feb 15 10:33:49 2017 -0500

    nfs-server-generator: handle 'noauto' mounts correctly
    
    When this code was written, the systemd documentation stated
    that "RequiresMountsFor" ignored mountpoints marked as "noauto".
    Unfortunately this is incorrect.  Consquently a filesystem marked
    as noauto that is also NFS exported will currently be mounted when
    the NFS server is started. This is not what people expect.
    
    So add a check for the noauto flag.  If any ancestor of a given
    export point has the noauto flag, no RequiresMountsFor will be
    generated for that point.
    
    Also skip RequiresMountsFor for exports marked 'mountpoint', as their
    absence is, theoretically, already handled by mountd.
    
    URL: https://github.com/systemd/systemd/issues/5249
    Signed-off-by: NeilBrown <neilb>
    Signed-off-by: Steve Dickson <steved>

Comment 7 ChunYu Wang 2017-04-06 07:29:22 UTC
Manually test shows this utility has been integrated into target nfs-utils version and can avoid adding filesystem target with 'noauto' flag automatically. 

--
[02:22:09 root@ ~~]# cat /etc/exports
/exportDir-defaults *(rw)
/exportDir-noauto *(rw)
[02:22:09 root@ ~~]# cat /etc/fstab | egrep '/exportDir-(defaults|noauto)'
/tmp/loop-defaults.image /exportDir-defaults xfs defaults 0 0
/tmp/loop-noauto.image /exportDir-noauto xfs noauto 0 0
[02:22:10 root@ ~~]# systemctl daemon-reload
[02:22:11 root@ ~~]# cat /run/systemd/generator/nfs-server.service.d/order-with-mounts.conf
# Automatically generated by nfs-server-generator

[Unit]
RequiresMountsFor=/exportDir-defaults
[02:22:11 root@ ~~]# service nfs restart
[02:22:11 root@ ~~]# mountpoint /exportDir-defaults
/exportDir-defaults is a mountpoint
[02:22:11 root@ ~~]# mountpoint /exportDir-noauto
/exportDir-noauto is not a mountpoint
--

Comment 9 ChunYu Wang 2017-04-06 07:33:27 UTC
Moved to VERIFIED according to comment 7/8, will keep an eye on this utility during future RHEL-7.4 tests.

Comment 10 errata-xmlrpc 2017-08-01 19:50:23 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-2017:2233


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