Bug 1440769

Summary: autofs is facing scalability issues
Product: Red Hat Enterprise Linux 7 Reporter: Marco Benatto <mbenatto>
Component: autofsAssignee: Ian Kent <ikent>
Status: CLOSED ERRATA QA Contact: xiaoli feng <xifeng>
Severity: high Docs Contact:
Priority: urgent    
Version: 7.3CC: djeffery, eguan, ikent, kzak, mbenatto
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: autofs-5.0.7-65.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 12:43:52 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:
Attachments:
Description Flags
RHEL7.3's autofs backported patch
none
Patch - improve scalability of direct mount path component
none
Program to create a large autofs direct mount map
none
autofs daemon coredump none

Description Marco Benatto 2017-04-10 12:48:21 UTC
Created attachment 1270487 [details]
RHEL7.3's autofs backported patch

Description of problem (from SFDC case):
"autofs service takes extremely long time since its creating the directory hierarchy for all direct mounts maps. We have quite a good number of direct maps ( approx 20k ) coming from LDAP and autofs fails when we restart autofs or system rebooted.  In /usr/lib/systemd/system/autofs.service changing  TimeoutSec to a higher values to  seems to work but hours to start automounter may not be a acceptable for production systems."
 
Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux 7
autofs-5.0.7-56.el7.x86_64
 
Additional info:
 
Customer is complaining about scalability issues when using autofs with large direct mappings. His environment has around 20k direct maps from LDAP and is taking a long time to complete the startup process impacting on their production.
 
Looking at upstream commits for autofs was possible to find:
 
 commit 67e7d613a4b09eeffc57ab44a7acb52027d897b2
 Author: Jeff Mahoney <jeffm>
 Date:   Thu Mar 24 09:13:50 2016 +0800
 
     autofs-5.1.1 - improve scalability of direct mount path component
 
     With direct mounts, we want to avoid creating path components on
     remote file systems unless that file system is the root file system.
 
     The check boils down to allowing the mkdir if:
     1/ If it's the root directory, or
     2/ If it's not a remote file system, or
     3/ If it's a remote file system that's the root file system
 
     We can do that without parsing the mount table and can
     improve startup time for all cases.
 
     Signed-off-by: Jeff Mahoney <jeffm>
     Signed-off-by: Ian Kent <raven>
 
which may fit this case. Checking on dist-git is possible to notice this patch wasn't being applied.
 
On last week I've backported it to rhel7.3 autofs version and built a test package which client had tested for the last four days. According to their testing the patch solved their issue.
 
I'm attaching backported patch for your review.

Thanks,
-Marco Benatto
Sr. Software Maintenance Engineer
Red Hat

Comment 8 Ian Kent 2017-04-17 00:53:38 UTC
Created attachment 1271935 [details]
Patch - improve scalability of direct mount path component

Comment 12 Ian Kent 2017-04-18 01:07:35 UTC
Created attachment 1272203 [details]
Program to create a large autofs direct mount map

I used this simple program to create an autofs direct mount
map with 30000 entries.

The mount location obviously relates to my own environment
and would need to be changed to be used within a beaker
test environment. Also the direct mount entry using the
map needs to be added to the master map.

Using this it is easy to reproduce the problem.

On limited capacity VM using autofs revision 56 automount
was only able to mount just over 4000 direct mounts before
systemd (with default settings) killed it for taking too
long.

With autofs revision 64 I was able to successfully start
autofs.

Comment 25 Marco Benatto 2017-05-09 13:38:17 UTC
Created attachment 1277371 [details]
autofs daemon coredump

Comment 58 errata-xmlrpc 2017-08-01 12:43:52 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:2213