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 1509043 - [RFE] "automount / amd: file system type program is not yet implemented" (Implement AMD program maps
Summary: [RFE] "automount / amd: file system type program is not yet implemented" (Imp...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: autofs
Version: 7.3
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Ian Kent
QA Contact: xiaoli feng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-02 19:13 UTC by Frank Hirtz
Modified: 2021-03-11 16:11 UTC (History)
7 users (show)

Fixed In Version: autofs-5.0.7-83.el7
Doc Type: Enhancement
Doc Text:
Feature: The am-utils amd program provides a mount type of program (ie. map entry option "type:=program") so that special types of mounts may be done using a user specified program for mounts that aren't possible using the standard mount types. Reason: This was difficult to do during the initial amd format map implementation within autofs and was deferred to be implemented once the initial implementation had stabilized, and to be done only if it was needed by customers. Result: This RFE shows that this amd map feature is needed by customers so it has been implemented. It is now possible to use the mount type program in amd format maps with autofs in the same way this is provided by the amd program.
Clone Of:
Environment:
Last Closed: 2018-04-10 18:17:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Example map setup (736 bytes, application/x-gzip)
2017-11-02 19:13 UTC, Frank Hirtz
no flags Details
Patch - improve debug logging of lookup key (5.07 KB, patch)
2017-11-10 06:46 UTC, Ian Kent
no flags Details | Diff
Patch - fix cachefs parse message not being logged (888 bytes, patch)
2017-11-10 06:47 UTC, Ian Kent
no flags Details | Diff
Patch - fix typo in amd_parse.c (972 bytes, patch)
2017-11-10 06:49 UTC, Ian Kent
no flags Details | Diff
Patch - add missing MODPREFIX to logging in amd parser (3.91 KB, patch)
2017-11-10 06:50 UTC, Ian Kent
no flags Details | Diff
Patch - fix symlink false negative in umount_multi() (1.32 KB, patch)
2017-11-10 06:52 UTC, Ian Kent
no flags Details | Diff
Patch - remove expand_selectors() call on amd parser entry (2.51 KB, patch)
2017-11-10 06:57 UTC, Ian Kent
no flags Details | Diff
Patch - fix amd defaults map entry handling (5.13 KB, patch)
2017-11-10 06:59 UTC, Ian Kent
no flags Details | Diff
Patch - refactor amd_parse.c (9.94 KB, patch)
2017-11-10 07:01 UTC, Ian Kent
no flags Details | Diff
Patch - fix amd parser double quote handling (5.87 KB, patch)
2017-11-10 07:02 UTC, Ian Kent
no flags Details | Diff
Patch - fix expandamdent() quote handling (2.16 KB, patch)
2017-11-10 07:04 UTC, Ian Kent
no flags Details | Diff
Patch - fix possible memory leak during amd parse (6.66 KB, patch)
2017-11-10 07:05 UTC, Ian Kent
no flags Details | Diff
Patch - remove path restriction of amd external mount (1.63 KB, patch)
2017-11-10 07:07 UTC, Ian Kent
no flags Details | Diff
Patch - add function umount_amd_ext_mount() (3.47 KB, patch)
2017-11-10 07:09 UTC, Ian Kent
no flags Details | Diff
Patch - add function ext_mount_inuse() (1.60 KB, patch)
2017-11-10 07:10 UTC, Ian Kent
no flags Details | Diff
Patch - add function construct_argv() (2.63 KB, patch)
2017-11-10 07:12 UTC, Ian Kent
no flags Details | Diff
Patch - add amd mount type program mount support (10.25 KB, patch)
2017-11-10 07:13 UTC, Ian Kent
no flags Details | Diff
Patch - fix memory leak in umount_amd_ext_mount() (1.14 KB, patch)
2017-12-11 08:04 UTC, Ian Kent
no flags Details | Diff
Patch - fix strerror_r() parameter declaration in do program_mount() (1.04 KB, patch)
2017-12-11 08:05 UTC, Ian Kent
no flags Details | Diff
Patch - fix incorrect check in validate_program_options() (1.01 KB, patch)
2017-12-11 08:07 UTC, Ian Kent
no flags Details | Diff
Patch - dont use array for path when not necessary (1.57 KB, patch)
2018-01-31 08:27 UTC, Ian Kent
no flags Details | Diff
Patch - fix prefix option handling in expand_entry() (1.59 KB, patch)
2018-01-31 08:28 UTC, Ian Kent
no flags Details | Diff
Patch - fix sublink option not set from defaults (1.07 KB, patch)
2018-01-31 08:29 UTC, Ian Kent
no flags Details | Diff
Patch - fix error return in do_nfs_mount() (939 bytes, patch)
2018-01-31 08:35 UTC, Ian Kent
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0977 0 None None None 2018-04-10 18:18:00 UTC

Description Frank Hirtz 2017-11-02 19:13:29 UTC
Created attachment 1347101 [details]
Example map setup

Description of problem:
Currently, the AMD map parser for autofs doesn't handle program maps and we'd like to request that "type:=program" be implemented/

This is a simple example that we'd like to work:

- /etc/auto.master.d/amd.autofs contains
/amd file,amd:/etc/amd.map

- /etc/amd.map contains

linux1 sublink:=linux;rhost:=host5;rfs:=/d/d2
linux2 type:=program;mount:="/usr/local/sbin/program.sh ${rhost} ${opts} ${rfs} ${fs}";opts:=ro;rhost:=host5;rfs:=/d/d1/linux

/amd/linux1 is mounted regularly but /amd/linux2 reports that "file system type program is not yet implemented" (if it worked, it would call that external program with appropriate parameters to perform the mount)

<snip>


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

autofs-5.0.7-69.el7.x86_64

Comment 3 Frank Hirtz 2017-11-02 19:14:48 UTC
Attached is an extract (and edited) version of some config and maps of amd that we'd like to be able to use via autofs.

/etc/amd.conf: defines two mount points /u and /v for which there are two separate maps

/etc/amd.map: defines /u mount points and:
 - /u/ammlinux works correctly
 - /u/ammprod doesn't work (it's the "link" problem logged in 01937545)

/etc/maps/toplvl.map: defines submaps (in other files) and:

/etc/maps/global.map: 
 - /v/global/user/m/ma/macchia works correctly
 - /v/campus/ln/appl/abc/v1/data/abcdefghij doesn't work (it's the "program" problem described in this ticket)

You will notice that "program" entry calls "${nfs4mount}" that is a variable defined in /etc/sysconfig/amd. This is a relatively simple script that invokes a mount for nfs4 with the parameters that are provided by amd.

Comment 7 Ian Kent 2017-11-10 06:46:03 UTC
Created attachment 1350301 [details]
Patch - improve debug logging of lookup key

Series 1 - bug fixes

Comment 8 Ian Kent 2017-11-10 06:47:58 UTC
Created attachment 1350302 [details]
Patch - fix cachefs parse message not being logged

Series 1 - bug fixes

Comment 9 Ian Kent 2017-11-10 06:49:18 UTC
Created attachment 1350303 [details]
Patch - fix typo in amd_parse.c

Series 1 - bug fixes

Comment 10 Ian Kent 2017-11-10 06:50:42 UTC
Created attachment 1350304 [details]
Patch - add missing MODPREFIX to logging in amd parser

Series 1 - bug fixes

Comment 11 Ian Kent 2017-11-10 06:52:36 UTC
Created attachment 1350305 [details]
Patch - fix symlink false negative in umount_multi()

Series 1 - bug fixes

Comment 12 Ian Kent 2017-11-10 06:57:12 UTC
Created attachment 1350306 [details]
Patch - remove expand_selectors() call on amd parser entry

Series 2 - fix "cannot mount or symlink <path> to itself"

Comment 13 Ian Kent 2017-11-10 06:59:10 UTC
Created attachment 1350307 [details]
Patch -  fix amd defaults map entry handling

Series 2 - fix "cannot mount or symlink <path> to itself"

Comment 14 Ian Kent 2017-11-10 07:01:02 UTC
Created attachment 1350309 [details]
Patch - refactor amd_parse.c

Series 3 - add support for mount type program

Comment 15 Ian Kent 2017-11-10 07:02:46 UTC
Created attachment 1350310 [details]
Patch - fix amd parser double quote handling

Series 3 - add support for amd mount type program

Comment 16 Ian Kent 2017-11-10 07:04:28 UTC
Created attachment 1350311 [details]
Patch - fix expandamdent() quote handling

Series 3 - add support for amd mount type prograam

Comment 17 Ian Kent 2017-11-10 07:05:57 UTC
Created attachment 1350312 [details]
Patch - fix possible memory leak during amd parse

Series 3 - add support for amd mount type program

Comment 18 Ian Kent 2017-11-10 07:07:31 UTC
Created attachment 1350313 [details]
Patch - remove path restriction of amd external mount

Series 3 - add support for amd mount type program

Comment 19 Ian Kent 2017-11-10 07:09:11 UTC
Created attachment 1350314 [details]
Patch - add function umount_amd_ext_mount()

Series 3 - add support for amd mount type program

Comment 20 Ian Kent 2017-11-10 07:10:41 UTC
Created attachment 1350316 [details]
Patch - add function ext_mount_inuse()

Series 3 - add support for amd mount type program

Comment 21 Ian Kent 2017-11-10 07:12:05 UTC
Created attachment 1350317 [details]
Patch - add function construct_argv()

Series 3 - add support for amd mount type program

Comment 22 Ian Kent 2017-11-10 07:13:53 UTC
Created attachment 1350318 [details]
Patch - add amd mount type program mount support

Series 3 - add support for amd mount type program

Comment 23 Ian Kent 2017-11-10 07:37:29 UTC
A test package with the above changes is available at:
http://people.redhat.com/~ikent/autofs-5.0.7-77.bz1509043.1.el7/

For me it resolves the macro translation problem that caused
the "cannot mount or symlink <path> to itself" problem. The
the mount type program implementation also seems to work ok.

I've done only limited testing so lets see how it goes.

Ian

Comment 27 Ian Kent 2017-12-11 08:04:02 UTC
Created attachment 1365809 [details]
Patch - fix memory leak in umount_amd_ext_mount()

Coverity identified fix.

Comment 28 Ian Kent 2017-12-11 08:05:26 UTC
Created attachment 1365810 [details]
Patch - fix strerror_r() parameter declaration in do program_mount()

Coverity identified fix.

Comment 29 Ian Kent 2017-12-11 08:07:46 UTC
Created attachment 1365811 [details]
Patch - fix incorrect check in validate_program_options()

Coverity identified fix.

Comment 43 Frank Hirtz 2018-01-25 19:51:58 UTC
<item two that they'd noted in testing>
I think I might have found a regression problem in the test package that you provided (http://people.redhat.com/~ikent/autofs-5.0.7-77.bz1509043.1.el7/):

- the current RHEL 7.4 version of autofs (5.0.7-70.el7_4.1) seems to handle correctly a config like the following:

$ grep tmp_ns /etc/auto.master.d/amd.autofs

/tmp_ns file,amd:/etc/maps/toplvl.map

$ grep -E '^global(/user(/m(/ma(/macchia)?)?)?)?[[:blank:]]' /etc/maps/*.map

/etc/maps/toplvl.map:global  type:=auto;fs:=${map/}/global.map;pref:=${key}/;opts:=browsable;cache:=all,sync
/etc/maps/global.map:global/user  type:=auto;fs:=${map};pref:=${key}/;opts:=browsable
/etc/maps/global.map:global/user/m  type:=auto;fs:=${map};pref:=${key}/;opts:=browsable
/etc/maps/global.map:global/user/m/ma  type:=auto;fs:=${map};pref:=${key}/;opts:=nobrowsable
/etc/maps/global.map:global/user/m/ma/macchia  type:=nfs;rhost:=lnn62f2;rfs:=/vol/lnn62f2v20/u_t1446798181;sublink:=macchia

$ cd /tmp_amd/global/user/m/ma/macchia
[ working as expected ]

- but the BZ version (same config as above), can't handle "user" and you get the following error when trying to "cd":

$ cd /tmp_amd/global/user/m/ma/macchia
-bash: cd: /tmp_amd/global/user/m/ma/macchia: No such file or directory

$ tail -f /var/log/messages
[...]
Jan 23 11:34:39 ferrari3 automount[1047]: key "user" not found in map source(s).

Please let me know if you need more info to debug this.

Also, I might have found other "incompatibilities" for these amd-compatible maps, but I'll log them in a separate ticket and let you know.
</item 2>

Comment 54 Ian Kent 2018-01-31 08:27:35 UTC
Created attachment 1388796 [details]
Patch - dont use array for path when not necessary

Comment 55 Ian Kent 2018-01-31 08:28:33 UTC
Created attachment 1388798 [details]
Patch - fix prefix option handling in expand_entry()

Comment 56 Ian Kent 2018-01-31 08:29:43 UTC
Created attachment 1388800 [details]
Patch - fix sublink option not set from defaults

Comment 57 Ian Kent 2018-01-31 08:35:42 UTC
Created attachment 1388801 [details]
Patch - fix error return in do_nfs_mount()

Comment 58 Ian Kent 2018-01-31 08:59:21 UTC
Please give this package a try:
http://people.redhat.com/~ikent/autofs-5.0.7-77.bz1509043.4.el7/

Also please set autofs_use_lofs = no in the autofs configuration
to get behaviour as close as it can be to amd, described above.

Comment 59 Frank Hirtz 2018-01-31 20:13:55 UTC
Preliminary feedback:

<snip>

Hi Frank,

it looks like all reported problems are resolved!
I'll run some extensive checks tomorrow but definitely all the test cases now work.

Thank you, Leonardo.
</snip>

I'll await followup from the client, but we're looking good. Thanks for the work!

Comment 60 xiaoli feng 2018-02-01 02:32:04 UTC
The routine tests for test package in comment 58 is ongoing.

Comment 61 Frank Hirtz 2018-02-01 15:13:43 UTC
<client feedback update>
I've run some tests and all the issues that I presented to you in this ticket (and the other about program mounts) are resolved with autofs-5.0.7-77.bz1509043.4.el7.

A couple of points:
- our amd maps are quite big and there's a chance I might hit some more incompatibilities in the future, if that's the case I'll open separate tickets
- there might be something with nfs4 and Kerberos that is not working as expected (when /etc/krb5.keytab is populated), but I haven't been able to fully understand that problem yet and also I'm not sure it's connected to autofs anyway
</feedback>

If QA testing doesn't show issues, are we in good shape for 7.5 inclusion?

Comment 62 Ian Kent 2018-02-01 23:41:05 UTC
We're going to need the blocker or exception flag set in order
to commit this late bug fix change for the customer reported
problem.

Steven, who should I contact to ask about this please.

Comment 76 Dave Wysochanski 2018-03-07 19:02:34 UTC
This needs a doc_text!

Comment 78 errata-xmlrpc 2018-04-10 18:17:12 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:0977


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