Bug 1612914

Summary: [autofs]Removed entries still can be accessed
Product: Red Hat Enterprise Linux 7 Reporter: Kun Wang <kunwan>
Component: autofsAssignee: Ian Kent <ikent>
Status: CLOSED ERRATA QA Contact: Kun Wang <kunwan>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.6CC: rhandlin, xzhou
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: autofs-5.0.7-95.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1613621 (view as bug list) Environment:
Last Closed: 2018-10-30 11:41:29 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: 1613621    
Attachments:
Description Flags
Patch - mark removed cache entry negative none

Description Kun Wang 2018-08-06 14:04:54 UTC
Description of problem:
This bug was found during I doing verification on Bug 1609128. PLZ refer to comment #24 and comment #27 of it.

Version-Release number of selected component (if applicable):
autofs-5.0.7-94.el7.x86_64

How reproducible:
always

Steps to Reproduce:

[root@hp-dl2x170g6-01 ~]# rpm -qa | grep autofs
autofs-5.0.7-94.el7.x86_64
[root@hp-dl2x170g6-01 ~]# cat /etc/auto.master
/n /etc/autofs/n -t 15
[root@hp-dl2x170g6-01 ~]# cat /etc/autofs/n                                                                           
nfs1 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test1
nfs2 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test2
nfs3 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test3
nfs4 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test4
[root@hp-dl2x170g6-01 ~]# service autofs restart
Redirecting to /bin/systemctl restart autofs.service
[root@hp-dl2x170g6-01 ~]# ls /n/nfs4
foo4 foo5 foo6 foo7
######################################################################
Now we comment out the nfs4
######################################################################
[root@hp-dl2x170g6-01 ~]# cat /etc/autofs/n                                                                           
nfs1 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test1
nfs2 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test2
nfs3 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test3
#nfs4 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test4
[root@hp-dl2x170g6-01 ~]# ls /n/nfs4
foo4 foo5 foo6 foo7
##########################################################################
do 'autofs reload' when it still mounted
#########################################################################
[root@hp-dl2x170g6-01 ~]# service autofs reload
Redirecting to /bin/systemctl reload autofs.service
######################################################################
now, the removed entry will persist....
around 1 hour later...(you should have noticed that I set '-t 15' in master map )
##########################################################################
[root@hp-dl2x170g6-01 ~]# ls /n/nfs4
foo4 foo5 foo6 foo7
[root@hp-dl2x170g6-01 ~]# cat /etc/autofs/n
nfs1 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test1
nfs2 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test2
nfs3 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test3
#nfs4 -rw,intr,hard intel-waimeabay-hedt-01.ml3.eng.bos.redhat.com:/test4
[root@hp-dl2x170g6-01 ~]# ls /n/nfs4
foo4 foo5 foo6 foo7

Actual results:
the removed entry still can be accessed

Expected results:
should not able to access. 

Additional info:

Comment 2 Ian Kent 2018-08-07 06:36:47 UTC
Requesting blocker flag as this has been reported as a result
of QE testing and the fix is simpler than I expected, so it
looks to be low risk to me.

I'll post the patch once I've done a little more testing.

Comment 3 Ian Kent 2018-08-07 10:14:35 UTC
Created attachment 1473944 [details]
Patch - mark removed cache entry negative

Comment 5 Kun Wang 2018-08-08 02:51:51 UTC
I tested on autofs-5.0.7-95.el7 for this bug.

The result shows that the removed entry won't be accessed after auto-umount. So this patch fixed this bug.

Comment 7 Kun Wang 2018-08-08 03:24:20 UTC
Now putting this BZ to verified state based on below test result:

#######################################################################
# on old version (autofs-5.0.7-94.el7), it failed                     #
#######################################################################
[22:42:19 root@ ~~]# service autofs reload
Redirecting to /bin/systemctl reload autofs.service
:: [ 22:42:19 ] :: [   PASS   ] :: Running 'service autofs reload' (Expected 0, got 0)
--------------------------------------------------------------------------------
[22:42:35 root@ ~~]# ls $nfsmp/$submp2
:: [ 22:42:35 ] :: [   FAIL   ] :: After reload removed entry shouldn't be accessable (Expected 2, got 0)

#######################################################################
# on fixed version (autofs-5.0.7-95.el7), it passed                   #
#######################################################################
[22:46:43 root@ ~~]# service autofs reload
Redirecting to /bin/systemctl reload autofs.service
:: [ 22:46:43 ] :: [   PASS   ] :: Running 'service autofs reload' (Expected 0, got 0)
--------------------------------------------------------------------------------
[22:47:03 root@ ~~]# ls $nfsmp/$submp2
ls: cannot access /mnt/nfsmp-bz1612914/NFS2: No such file or directory
:: [ 22:47:03 ] :: [   PASS   ] :: After reload removed entry shouldn't be accessable (Expected 2, got 2)

Comment 9 errata-xmlrpc 2018-10-30 11:41:29 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:3283