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 1885511 - automount force unlink option (-F) does not work as expected on autofs-5.0.7-109.el7 [rhel-7.9.z]
Summary: automount force unlink option (-F) does not work as expected on autofs-5.0.7-...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: autofs
Version: 7.8
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Ian Kent
QA Contact: Kun Wang
URL:
Whiteboard:
Depends On:
Blocks: 1887681
TreeView+ depends on / blocked
 
Reported: 2020-10-06 08:45 UTC by Roberto Bergantinos
Modified: 2024-03-25 16:38 UTC (History)
7 users (show)

Fixed In Version: autofs-5.0.7-115
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1887681 (view as bug list)
Environment:
Last Closed: 2020-12-15 11:18:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch - fix direct mount unlink_mount_tree() path (1.13 KB, patch)
2020-10-06 10:20 UTC, Ian Kent
no flags Details | Diff
Patch - fix unlink mounts umount order (2.38 KB, patch)
2020-10-06 10:21 UTC, Ian Kent
no flags Details | Diff
Patch - fix incorrect logical compare in unlink_mount_tree() (979 bytes, patch)
2020-10-30 08:20 UTC, Ian Kent
no flags Details | Diff

Description Roberto Bergantinos 2020-10-06 08:45:02 UTC
Description of problem:

automount force unlink option (-F) does not work as expected on autofs-5.0.7-109.el7

according to man this option should clean up / unlink any mount present from previous incarnation :

==============================
  -F, --force

Force an unlink umount of existing mounts under autofs managed mount points during startup. 
This can cause problems for processes with working directories within these mounts (see NOTES).
==============================

But does not work as expected on RHEL7.8, autofs-5.0.7-109.el7 :

[root@rhel77 ~]# automount -V | grep version
Linux automount version 5.0.7-109.el7

[root@rhel77 ~]# grep -iE "autofs|nfs" /proc/mounts 
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=22,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=9826 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=5,pgrp=7726,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=46267 0 0
-hosts /net autofs rw,relatime,fd=11,pgrp=7726,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=45820 0 0
/etc/auto.test /direct_test/test autofs rw,relatime,fd=17,pgrp=7726,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=45824 0 0

[root@rhel77 ~]# cd /direct_test/test
[root@rhel77 test]# pkill -9 automount
[root@rhel77 test]# /usr/sbin/automount -d --pid-file /run/autofs.pid -F

[root@rhel77 test]# grep -iE "autofs|nfs" /proc/mounts
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=22,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=9826 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
/etc/auto.test /direct_test/test autofs rw,relatime,fd=17,pgrp=7726,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=45824 0 0
rhel73:/5GBshare /direct_test/test nfs4 rw,relatime,vers=4.1,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.23.1.247,local_lock=none,addr=172.23.1.225 0 0

---> both autofs/NFS entries still present, autofs still have old process group

/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=7756,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=45880 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=7756,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=46312 0 0
/etc/auto.test /direct_test/test autofs rw,relatime,fd=19,pgrp=7756,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=46316 0 0

This worked as expected on 5.0.7-106.el7 :

[root@rhel77 ~]# automount -V | grep version
Linux automount version 5.0.7-106.el7

[root@rhel77 ~]# grep -iE "autofs|nfs" /proc/mounts 
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
/etc/auto.test /direct_test/test autofs rw,relatime,fd=16,pgrp=11931,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=46048 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=5,pgrp=11931,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=46668 0 0
-hosts /net autofs rw,relatime,fd=11,pgrp=11931,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=46046 0 0

[root@rhel77 ~]# cd /direct_test/test
[root@rhel77 test]# pkill -9 automount
[root@rhel77 test]# /usr/sbin/automount -d --pid-file /run/autofs.pid -F

[root@rhel77 test]# grep -iE "autofs|nfs" /proc/mounts
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=11964,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=46713 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=11964,timeout=300,minproto=5,maxproto=5,indirect,pipe_ino=46722 0 0
/etc/auto.test /direct_test/test autofs rw,relatime,fd=19,pgrp=11964,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=46726 0 0


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

autofs-5.0.7-109.el7


How reproducible: 100%


Steps to Reproduce:

1. See Description for reproducer
2.
3.

Actual results: autofs referencing previous autofs incarnation still around


Expected results: unlink entries


Additional info:

Comment 2 Ian Kent 2020-10-06 10:20:53 UTC
Created attachment 1719324 [details]
Patch - fix direct mount unlink_mount_tree() path

Comment 3 Ian Kent 2020-10-06 10:21:51 UTC
Created attachment 1719325 [details]
Patch - fix unlink mounts umount order

Comment 28 Ian Kent 2020-10-30 08:20:27 UTC
Created attachment 1725247 [details]
Patch - fix incorrect logical compare in unlink_mount_tree()

Fix a mistake spotted by Coverity.

Strictly speaking this should make no difference to the operation
of the function but should be fixed.

In both cases of the conditional check the mount is detached but
in the later case umount(8) is used which will capture and log
any error output from the command.

Comment 35 errata-xmlrpc 2020-12-15 11:18:02 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 (autofs bug fix and enhancement update), 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-2020:5438


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