- add changes for bug 2149013.

This commit is contained in:
Ian Kent 2022-12-06 14:20:13 +08:00
parent 270e1fdc3e
commit f59047e892
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,63 @@
autofs-5.1.8 - fix incorrect path for is_mounted() in try_remount()
From: Ian Kent <raven@themaw.net>
A regression was introduced when the offset mount handling was rewritten.
It resulted in an incorrect path sometimes being used in an is_mounted()
check.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/mounts.c | 26 +++++++++++++++++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
--- autofs-5.1.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@@ -111,6 +111,7 @@
- fix deadlock with hosts map reload.
- fix memory leak in update_hosts_mounts().
- fix minus only option handling in concat_options().
+- fix incorrect path for is_mounted() in try_remount().
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/lib/mounts.c
+++ autofs-5.1.7/lib/mounts.c
@@ -2803,14 +2803,30 @@ int try_remount(struct autofs_point *ap,
ap->flags &= ~MOUNT_FLAG_DIR_CREATED;
else
ap->flags |= MOUNT_FLAG_DIR_CREATED;
+ goto done;
+ }
+
+ me->flags &= ~MOUNT_FLAG_DIR_CREATED;
+ /* Direct or offset mount, key is full path */
+ if (MM_PARENT(me)->key[0] == '/') {
+ if (!is_mounted(MM_PARENT(me)->key, MNTS_REAL))
+ me->flags |= MOUNT_FLAG_DIR_CREATED;
} else {
- me->flags &= ~MOUNT_FLAG_DIR_CREATED;
- if (type == t_offset) {
- if (!is_mounted(MM_PARENT(me)->key, MNTS_REAL))
- me->flags |= MOUNT_FLAG_DIR_CREATED;
+ char *p_key = MM_PARENT(me)->key;
+ char mp[PATH_MAX + 1];
+ int len;
+
+ len = mount_fullpath(mp, PATH_MAX, ap->path, ap->len, p_key);
+ if (len > PATH_MAX) {
+ /* This should never happen due to earlier checks */
+ error(ap->logopt, "mountpoint path too long");
+ return 0;
}
- }
+ if (!is_mounted(mp, MNTS_REAL))
+ me->flags |= MOUNT_FLAG_DIR_CREATED;
+ }
+done:
/*
* Either we opened the mount or we're re-reading the map.
* If we opened the mount and ioctlfd is not -1 we have

View File

@ -12,7 +12,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.7
Release: 35%{?dist}
Release: 36%{?dist}
Epoch: 1
License: GPLv2+
Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}-2.tar.gz
@ -137,6 +137,7 @@ Patch109: autofs-5.1.8-fix-hosts-map-deadlock-on-restart.patch
Patch110: autofs-5.1.8-fix-deadlock-with-hosts-map-reload.patch
Patch111: autofs-5.1.8-fix-memory-leak-in-update_hosts_mounts.patch
Patch112: autofs-5.1.8-fix-minus-only-option-handling-in-concat_options.patch
Patch113: autofs-5.1.8-fix-incorrect-path-for-is_mounted-in-try_remount.patch
%if %{with_systemd}
BuildRequires: systemd-units
@ -318,6 +319,7 @@ echo %{version}-%{release} > .version
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%build
LDFLAGS=-Wl,-z,now
@ -426,6 +428,12 @@ fi
%dir /etc/auto.master.d
%changelog
* Tue Dec 06 2022 Ian Kent <ikent@redhat.com> - 1:5.1.7-36
- bz2149013 - autofs: errors in autofs-5.1.4-83.el8.x86_64 when restarting
autofs with busy directories
- fix incorrect path for is_mounted() in try_remount().
- Resolves: rhbz#2149013
* Wed Nov 30 2022 Ian Kent <ikent@redhat.com> - 1:5.1.7-35
- bz2145251 - RHEL9: automount does not handle null option string after
"-" anymore