autofs/autofs-5.1.9-refactor-amd-mount-options-handling.patch
Ian Kent b58878d9dd Add Add fixes for Jiras RHEL-69485 RHEL-71359 and RHEL-57466
This MR adds fixes for several Jiras.

- RHEL-57466 - autofs crashes on startup after IDM client configuration
We have had several different reports caused by this bug which leads to a
SEGV with very little information about the cuase.

- Resolves: RHEL-57466

- RHEL-69485 - Sporadic mount failures with amd program maps on RHEL8.
This bug causes AMD-style program map mounts to sporadically not work.

- Resolves: RHEL-69485

- RHEL-71359 - RFE: autofs: add handling for AMD 'nounmount' option
This Jira adds support for a map option that was deferred in the original
implementtion. One of our customers needs this so it has been implemented.

- Resolves: RHEL-71359

Signed-off-by: Ian Kent <ikent@redhat.com>
2024-12-17 11:04:01 +08:00

122 lines
3.4 KiB
Diff

commit b48aab92dd3f47411a8ccd67ff4370cbfee64581
Author: Ian Kent <raven@themaw.net>
Date: Thu Jul 11 13:35:04 2024 +0800
autofs-5.1.9 - refactor amd mount options handling
Refactor handling of entry options opts, addopts, remopts.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1
modules/amd_parse.y | 66 ++++++++++++++++++++++++++++++----------------------
2 files changed, 40 insertions(+), 27 deletions(-)
--- autofs-5.1.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@@ -170,6 +170,7 @@
- fix amd cache options not copied.
- seperate amd mount and entry flags.
- make iocl ops ->timeout() handle per-dentry expire.
+- refactor amd mount options handling.
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/modules/amd_parse.y
+++ autofs-5.1.7/modules/amd_parse.y
@@ -60,6 +60,7 @@ static int match_map_option_fs_type(char
static int match_map_option_map_type(char *map_option, char *type);
static int match_map_option_cache_option(char *type);
static int match_mnt_option_options(char *mnt_option, char *options);
+static int match_mnt_option(char *option, char *options);
static struct amd_entry entry;
static struct list_head *entries;
@@ -437,40 +438,18 @@ option_assignment: MAP_OPTION OPTION_ASS
options: OPTION
{
- if (!strcmp($1, "fullybrowsable") ||
- !strcmp($1, "nounmount")) {
- sprintf(msg_buf, "option %s is not currently "
- "implemented, ignored", $1);
- amd_info(msg_buf);
- } else if (!strncmp($1, "ping=", 5) ||
- !strncmp($1, "retry=", 6) ||
- !strcmp($1, "public") ||
- !strcmp($1, "softlookup") ||
- !strcmp($1, "xlatecookie")) {
- sprintf(msg_buf, "option %s is not used by "
- "autofs, ignored", $1);
- amd_info(msg_buf);
- } else if (!strncmp($1, "utimeout=", 9)) {
- if (entry.flags & AMD_MOUNT_TYPE_AUTO) {
- char *opt = $1;
- prepend_opt(opts, ++opt);
- } else {
- sprintf(msg_buf, "umount timeout can't be "
- "used for other than type "
- "\"auto\" with autofs, "
- "ignored");
- amd_info(msg_buf);
- }
- } else
+ if (match_mnt_option($1, opts))
prepend_opt(opts, $1);
}
| OPTION COMMA options
{
- prepend_opt(opts, $1);
+ if (match_mnt_option($1, opts))
+ prepend_opt(opts, $1);
}
| OPTION COMMA
{
- prepend_opt(opts, $1);
+ if (match_mnt_option($1, opts))
+ prepend_opt(opts, $1);
}
;
@@ -664,6 +643,39 @@ static int match_mnt_option_options(char
return 1;
}
+static int match_mnt_option(char *option, char *options)
+{
+ int ret = 0;
+
+ if (!strcmp(option, "fullybrowsable") ||
+ !strcmp(option, "nounmount")) {
+ sprintf(msg_buf, "option %s is not currently "
+ "implemented, ignored", option);
+ amd_info(msg_buf);
+ } else if (!strncmp(option, "ping=", 5) ||
+ !strncmp(option, "retry=", 6) ||
+ !strcmp(option, "public") ||
+ !strcmp(option, "softlookup") ||
+ !strcmp(option, "xlatecookie")) {
+ sprintf(msg_buf, "option %s is not used by "
+ "autofs, ignored", option);
+ amd_info(msg_buf);
+ } else if (!strncmp(option, "utimeout=", 9)) {
+ if (entry.flags & AMD_MOUNT_TYPE_AUTO)
+ prepend_opt(options, ++option);
+ else {
+ sprintf(msg_buf, "umount timeout can't be "
+ "used for other than type "
+ "\"auto\" with autofs, "
+ "ignored");
+ amd_info(msg_buf);
+ }
+ } else
+ ret = 1;
+
+ return ret;
+}
+
static void prepend_opt(char *dest, char *opt)
{
char new[MAX_OPTS_LEN];