From 52ace323555180ee62a28eb8b28ce6964c7a781c Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Mon, 9 Mar 2026 10:16:46 +0800 Subject: [PATCH] - add additional fixes for the amd nounmount option support (RHEL-150237). --- ...flags-update-in-update_with_defaults.patch | 41 +++++++++++++++++++ ...xpire-check-for-amd-nounmount-mounts.patch | 36 ++++++++++++++++ autofs.spec | 15 ++++++- 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 autofs-5.1.9-fix-incorrect-flags-update-in-update_with_defaults.patch create mode 100644 autofs-5.1.9-skip-expire-check-for-amd-nounmount-mounts.patch diff --git a/autofs-5.1.9-fix-incorrect-flags-update-in-update_with_defaults.patch b/autofs-5.1.9-fix-incorrect-flags-update-in-update_with_defaults.patch new file mode 100644 index 0000000..0e34e5e --- /dev/null +++ b/autofs-5.1.9-fix-incorrect-flags-update-in-update_with_defaults.patch @@ -0,0 +1,41 @@ +autofs-5.1.9 - fix incorrect flags update in update_with_defaults() + +From: Ian Kent + +After adding support for some additional am-utils map entry options at +least one of them, "nounmount", and probably others don't work in some +cases. + +This is because some of them are is implemented using a flag in the map +entry which was incorrectly being cleared during updating the entry with +current defaults. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/parse_amd.c | 4 +++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- autofs-5.1.7.orig/CHANGELOG ++++ autofs-5.1.7/CHANGELOG +@@ -197,6 +197,7 @@ + - fix stale direct mount trigger not umounted on expire. + - add function table_lookup_ino(). + - improve handling of missing map entry for mount request. ++- fix incorrect flags update in update_with_defaults(). + + 25/01/2021 autofs-5.1.7 + - make bind mounts propagation slave by default. +--- autofs-5.1.7.orig/modules/parse_amd.c ++++ autofs-5.1.7/modules/parse_amd.c +@@ -654,7 +654,9 @@ static void update_with_defaults(struct + if (deftype != AMD_MOUNT_TYPE_NONE) + entry->flags |= (defaults->flags & AMD_MOUNT_TYPE_MASK); + else { +- entry->flags = AMD_MOUNT_TYPE_NFS; ++ unsigned long per_mnt_flags = entry->flags & AMD_MOUNT_OPT_MASK; ++ ++ entry->flags = AMD_MOUNT_TYPE_NFS | per_mnt_flags; + tmp = strdup("nfs"); + if (tmp) + entry->type = tmp; diff --git a/autofs-5.1.9-skip-expire-check-for-amd-nounmount-mounts.patch b/autofs-5.1.9-skip-expire-check-for-amd-nounmount-mounts.patch new file mode 100644 index 0000000..4b359b8 --- /dev/null +++ b/autofs-5.1.9-skip-expire-check-for-amd-nounmount-mounts.patch @@ -0,0 +1,36 @@ +autofs-5.1.9 - skip expire check for amd nounmount mounts + +From: Ian Kent + +There's no need to check amd mounts with the "nounmount" option set. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/indirect.c | 5 +++++ + 2 files changed, 6 insertions(+) + +--- autofs-5.1.7.orig/CHANGELOG ++++ autofs-5.1.7/CHANGELOG +@@ -198,6 +198,7 @@ + - add function table_lookup_ino(). + - improve handling of missing map entry for mount request. + - fix incorrect flags update in update_with_defaults(). ++- skip expire check for amd nounmount mounts. + + 25/01/2021 autofs-5.1.7 + - make bind mounts propagation slave by default. +--- autofs-5.1.7.orig/daemon/indirect.c ++++ autofs-5.1.7/daemon/indirect.c +@@ -377,6 +377,11 @@ void *expire_proc_indirect(void *arg) + char *ind_key; + int ret; + ++ /* No need to check "nounmount" amd mounts */ ++ if (mnt->flags & MNTS_AMD_MOUNT && ++ mnt->amd_flags & AMD_MOUNT_OPT_NOUNMOUNT) ++ continue; ++ + if (mnt->flags & (MNTS_AUTOFS|MNTS_OFFSET)) { + /* + * If we have submounts check if this path lives below diff --git a/autofs.spec b/autofs.spec index d0546cc..ee21071 100644 --- a/autofs.spec +++ b/autofs.spec @@ -12,7 +12,7 @@ Summary: A tool for automatically mounting and unmounting filesystems Name: autofs Version: 5.1.7 -Release: 66%{?dist} +Release: 67%{?dist} Epoch: 1 License: GPLv2+ Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}-2.tar.gz @@ -246,6 +246,10 @@ Patch222: autofs-5.1.9-fix-stale-direct-mount-trigger-not-umounted-on-expire.pat Patch223: autofs-5.1.9-add-function-table_lookup_ino.patch Patch224: autofs-5.1.9-improve-handling-of-missing-map-entry-for-mount-request.patch +# JIRA: RHEL-150237 +Patch225: autofs-5.1.9-fix-incorrect-flags-update-in-update_with_defaults.patch +Patch226: autofs-5.1.9-skip-expire-check-for-amd-nounmount-mounts.patch + %if %{with_systemd} BuildRequires: systemd-units BuildRequires: systemd-devel @@ -521,6 +525,9 @@ echo %{version}-%{release} > .version %patch -P 223 -p1 %patch -P 224 -p1 +%patch -P 225 -p1 +%patch -P 226 -p1 + %build LDFLAGS=-Wl,-z,now %configure \ @@ -628,6 +635,12 @@ fi %dir /etc/auto.master.d %changelog +* Wed Mar 09 2026 Ian Kent - 1:5.1.7-67 +- RHEL-150237 - RFE: autofs: add handling for AMD 'nounmount' option [rhel-9] + - fix incorrect flags update in update_with_defaults(). + - skip expire check for amd nounmount mounts. +- Resolves: RHEL-150237 + * Wed Mar 04 2026 Ian Kent - 1:5.1.7-66 - RHEL-113623 - Wrong oz_pgrp in autofs_sb_info causes automount to wait on automount.