Bug 1367576

Summary: [RFE] Add browsing support into autofs for AMD format maps
Product: Red Hat Enterprise Linux 7 Reporter: Frank Hirtz <fhirtz>
Component: autofsAssignee: Ian Kent <ikent>
Status: CLOSED ERRATA QA Contact: xiaoli feng <xifeng>
Severity: medium Docs Contact: Milan Navratil <mnavrati>
Priority: unspecified    
Version: 7.2CC: dwysocha, eguan, fhirtz, ikent, mthacker
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: autofs-5.0.7-65.el7 Doc Type: Release Note
Doc Text:
*autofs* now supports the browse options of `amd` format maps The browse functionality of sun format maps makes available automount points visible in directory listings of mounted automount-managed mounts and is now also available for *autofs* `amd` format maps. You can now add mount point sections to the *autofs* configuration for `amd` format mounts, in the same way automount points are configured in `amd`, without the need to also add a corresponding entry to the master map. As a result, you can avoid having incompatible master map entries in the *autofs* master map within shared multi-vendor environments. The "browsable_dirs" option can be used in either the *autofs* `[ amd ]` configuration section, or following `amd` mount point sections. The "browsable" and "utimeout" map options of amd type "auto" map entries can also be used. Note that the "browsable_dirs" option can be set only to `yes` or `no`.
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:
Bug Depends On:    
Bug Blocks: 1298243, 1385242    
Attachments:
Description Flags
Patch - fix short memory allocation in lookup_amd_instance()
none
Patch - fix count_mounts() function
none
Patch - fix argc off by one in mount_autofs.c
none
Patch - add ref counting to struct map_source
none
Patch - add support for amd browsable option
none
Patch - add ref counting to struct map_source (updated)
none
Patch - fix typos in README.amd-maps
none
Patch - add support for amd browsable option (updated)
none
Patch - add function conf_amd_get_map_name()
none
Patch - add function conf_amd_get_mount_paths()
none
Patch - include amd mount section mounts in master mounts list
none
Patch - add support for amd browsable option (update 2)
none
Patch - include amd mount section mounts in master mounts list (updated)
none
Patch - check for conflicting amd section mounts
none
Patch - add function conf_amd_get_map_name() (updated)
none
Patch - add function conf_amd_get_mount_paths() (updated)
none
Patch - check for conflicting amd section mounts (updated)
none
Patch - add function conf_get_map_options()
none
Patch - capture cache option and its settings during parsing
none
Patch - handle map_option cache for top level mounts
none
Patch - handle amd cache option all in amd type auto mounts
none
Patch - fix _strncmp() usage
none
Patch - add function conf_amd_get_map_name()
none
Patch - add function conf_amd_get_map_options()
none
Patch - handle map_option cache for top level mounts (updated)
none
Patch - fix bogus check in expire_cleanup()
none
Patch - delay submount exit for amd submounts
none
Patch - use autofs_point to store expire timeout where possibe
none
Patch - fix possible NULL derefernce
none
Patch - fix invalid reference in remount_active_mount() none

Description Frank Hirtz 2016-08-16 20:30:06 UTC
Description of problem:
We've discussed this with Ian, and the work's already in progress, but we wanted to formalize a request:

<snip>
Even though I don't yet have an RFE for this I have done some preliminary
evaluation of the request. Unfortunately for me the way I would like to do it
will add an unacceptable amount of complexity for insufficient benefit.

That means 2 things.

First, I'll need to do this within the existing browse framework in autofs.
While not ideal from my POV I don't have any choice and initial investigation
indicates the change is fairly straight forward doing it within the existing
browse framework.

Second, I will not be able to implement the amd "fullybrowsable" option for amd
format maps in autofs for the foreseeable future. AFAICS that option has limited
use apart from perhaps amd map debugging, also Richard doesn't need this
functionality, so that shouldn't be a problem.

Being that it looked fairly straight forward the investigation resulted in an
initial partial implementation
...
I have a start to that already but considering your environment I see another
problem that I'll need to fix. I'm thinking about how to do that as well as
contributing to the autofs discussion.

It will be necessary to check that the amd map format support will function
acceptably without the additional fix.
</snip>

This will require implementation and client validation for their map setup.

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

Additional info:

This request came out of a discussion with Ian Kent and the client, so there's a bit of history on it.

Comment 1 Ian Kent 2016-08-17 02:30:43 UTC
Created attachment 1191452 [details]
Patch - fix short memory allocation in lookup_amd_instance()

Comment 2 Ian Kent 2016-08-17 02:31:59 UTC
Created attachment 1191453 [details]
Patch - fix count_mounts() function

Comment 3 Ian Kent 2016-08-17 02:32:52 UTC
Created attachment 1191454 [details]
Patch - fix argc off by one in mount_autofs.c

Comment 4 Ian Kent 2016-08-17 02:33:58 UTC
Created attachment 1191455 [details]
Patch - add ref counting to struct map_source

Comment 5 Ian Kent 2016-08-17 02:35:23 UTC
Created attachment 1191456 [details]
Patch - add support for amd browsable option

Comment 6 Ian Kent 2016-08-17 02:54:49 UTC
Created attachment 1191458 [details]
Patch - add ref counting to struct map_source (updated)

Fix patch description.

Comment 7 Ian Kent 2016-08-17 03:26:05 UTC
An initial test package with the above changes has been built.

It is located at:
http://people.redhat.com/ikent/autofs-5.0.7-56.bz1367576.2.el7/

We need to test there are not side effects of this change and
that the change works ok in the customer environment since the
scale of the customer environment is large.

I can help QE with test development for verification of the
required functionality.

Comment 8 Ian Kent 2016-08-17 03:34:05 UTC
(In reply to Frank Hirtz from comment #0)
> ...
> I have a start to that already but considering your environment I see another
> problem that I'll need to fix. I'm thinking about how to do that as well as
> contributing to the autofs discussion.

The problem that I was referring to above is related to the
frequent map reuse that is common in amd map configurations.

Given the size of the maps that will be used here the lack
of map reuse would have been a significant problem but I
believe it is addressed by the patch that adds reference
counting to the top level map source structure.

We will need to see if this is sufficient and watch out for
side effects of this particular change.

Comment 12 Ian Kent 2016-08-31 01:58:05 UTC
Created attachment 1196135 [details]
Patch - fix typos in README.amd-maps

Comment 13 Ian Kent 2016-08-31 01:59:31 UTC
Created attachment 1196136 [details]
Patch - add support for amd browsable option (updated)

Add documentation and man page changes.

Comment 14 Ian Kent 2016-08-31 02:00:27 UTC
Created attachment 1196137 [details]
Patch - add function conf_amd_get_map_name()

Comment 15 Ian Kent 2016-08-31 02:01:11 UTC
Created attachment 1196138 [details]
Patch - add function conf_amd_get_mount_paths()

Comment 16 Ian Kent 2016-08-31 02:02:13 UTC
Created attachment 1196139 [details]
Patch - include amd mount section mounts in master mounts list

Comment 17 Ian Kent 2016-08-31 02:08:41 UTC
An updated test package with the above changes has been built.

It is located at:
http://people.redhat.com/ikent/autofs-5.0.7-56.bz1367576.3.el7/

This package adds the ability of autofs to use top level amd
mount sections of the autofs configuration instead of requiring
an additional master map entry.

Please give this a try and let us know how it goes.

Comment 18 Ian Kent 2016-09-01 09:01:35 UTC
Created attachment 1196643 [details]
Patch - add support for amd browsable option (update 2)

Remove debug log statement.

Comment 19 Ian Kent 2016-09-01 09:02:58 UTC
Created attachment 1196644 [details]
Patch - include amd mount section mounts in master mounts list (updated)

Fix CHANGELOG text.

Comment 20 Ian Kent 2016-09-01 09:03:42 UTC
Created attachment 1196645 [details]
Patch - check for conflicting amd section mounts

Comment 21 Ian Kent 2016-09-01 09:37:32 UTC
An updated test package with the above changes has been built.

It is located at:
http://people.redhat.com/ikent/autofs-5.0.7-56.bz1367576.4.el7/

This package adds a check for amd section mounts that conflict
with entries in the master map and includes a couple of other
minor updates to existing patches.

It would be good if this package could be tested, I need to know
if this functions in the customer environment and to find out
what else I need to fix.

Comment 22 Ian Kent 2016-09-05 09:03:33 UTC
Created attachment 1197821 [details]
Patch - add function conf_amd_get_map_name() (updated)

- fix typo in patch description.

Comment 23 Ian Kent 2016-09-05 09:04:57 UTC
Created attachment 1197822 [details]
Patch - add function conf_amd_get_mount_paths() (updated)

- fix initialization mistake in conf_enumerate_amd_mount_sections().

Comment 24 Ian Kent 2016-09-05 09:06:25 UTC
Created attachment 1197823 [details]
Patch - check for conflicting amd section mounts (updated)

- fix path not applied.
- update patch to check for existing amd master map entry and
  not issue message.

Comment 25 Ian Kent 2016-09-05 09:08:17 UTC
Created attachment 1197824 [details]
Patch - add function conf_get_map_options()

Comment 26 Ian Kent 2016-09-05 09:09:41 UTC
Created attachment 1197825 [details]
Patch - capture cache option and its settings during parsing

Comment 27 Ian Kent 2016-09-05 09:10:49 UTC
Created attachment 1197826 [details]
Patch - handle map_option cache for top level mounts

Comment 28 Ian Kent 2016-09-05 09:11:43 UTC
Created attachment 1197827 [details]
Patch - handle amd cache option all in amd type auto mounts

Comment 29 Ian Kent 2016-09-05 09:31:08 UTC
An updated test package with the above changes has been built.

It is located at:
http://people.redhat.com/ikent/autofs-5.0.7-56.bz1367576.5.el7/

Changes since revision 4:
- fix typo in description of add function conf_amd_get_map_name()
  patch.
- fix initialization mistake in conf_enumerate_amd_mount_sections().
- fix patch not applied and update check for existing amd master map
  entry.
- add handling of amd cache option for top level and type auto
  mounts.

Please test this build.

Comment 30 Mark Thacker 2016-11-23 17:32:40 UTC
Adding pm_ack to this and placing it on the RHEL 7.4 Filesystems and Storage RPL

Comment 32 Dave Wysochanski 2016-11-28 22:09:42 UTC
As far as I know moving forward with this bug depends on feedback from the latest autofs test package per https://bugzilla.redhat.com/show_bug.cgi?id=1367576#c29

Comment 36 Ian Kent 2017-03-16 09:43:17 UTC
Created attachment 1263609 [details]
Patch - fix _strncmp() usage

Comment 37 Ian Kent 2017-03-16 09:45:35 UTC
Created attachment 1263610 [details]
Patch - add function conf_amd_get_map_name()

Changed function name from conf_get_map_name() to conf_amd_get_map_name().

Comment 38 Ian Kent 2017-03-16 09:49:52 UTC
Created attachment 1263611 [details]
Patch - add function conf_amd_get_map_options()

Oops, actually the function name change was in this patch.
conf_get_map_options() -> conf_amd_get_map_options()

Comment 39 Ian Kent 2017-03-16 09:53:46 UTC
Created attachment 1263612 [details]
Patch - handle map_option cache for top level mounts (updated)

And this patch changed to use the conf_amd_get_get_map_options().

Comment 40 Ian Kent 2017-03-16 09:56:08 UTC
Created attachment 1263614 [details]
Patch - fix bogus check in expire_cleanup()

Dependency patch.

Comment 41 Ian Kent 2017-03-16 09:57:02 UTC
Created attachment 1263615 [details]
Patch - delay submount exit for amd submounts

Comment 49 Ian Kent 2017-03-28 01:19:41 UTC
Created attachment 1266812 [details]
Patch - use autofs_point to store expire timeout where possibe

Almost missed this patch which was partly completed.

It is needed to properly support the "utimeout" option of amd
type "auto" submounts.

Comment 51 Ian Kent 2017-03-30 08:22:36 UTC
Created attachment 1267442 [details]
Patch - fix possible NULL derefernce

Covarity identified fix.

Comment 53 Ian Kent 2017-04-23 23:59:24 UTC
Created attachment 1273487 [details]
Patch - fix invalid reference in remount_active_mount()

Fix a mistake found in testing when getting the expire timeout at startup when re-connecting to existing mounts.

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