beb904
autofs-5.1.6 - fix remount expire
beb904
beb904
From: Ian Kent <raven@themaw.net>
beb904
beb904
When starting autofs when there are active mounts due to in use
beb904
mounts from a previous shutdown, and a mount entry has offsets,
beb904
and an offset doesn't have a real mount due to a non-strict fail
beb904
returning success for the remount a file handle is incorrectly
beb904
left open.
beb904
beb904
The file handle gets assingned to the offset entry for expires
beb904
but since there is no mount to expire it never gets closed which
beb904
prevents the multi-mount owner itself from expiring.
beb904
beb904
Signed-off-by: Ian Kent <raven@themaw.net>
beb904
---
beb904
 CHANGELOG    |    1 +
beb904
 lib/mounts.c |    8 +++++++-
beb904
 2 files changed, 8 insertions(+), 1 deletion(-)
beb904
beb904
--- autofs-5.1.4.orig/CHANGELOG
beb904
+++ autofs-5.1.4/CHANGELOG
beb904
@@ -126,6 +126,7 @@ xx/xx/2018 autofs-5.1.5
beb904
 - use mnt_list for amdmounts.
beb904
 - make umount_autofs() static.
beb904
 - remove force parameter from umount_all().
beb904
+- fix remount expire.
beb904
 
beb904
 19/12/2017 autofs-5.1.4
beb904
 - fix spec file url.
beb904
--- autofs-5.1.4.orig/lib/mounts.c
beb904
+++ autofs-5.1.4/lib/mounts.c
beb904
@@ -2205,8 +2205,14 @@ int try_remount(struct autofs_point *ap,
beb904
 		if (fd != -1) {
beb904
 			if (type == t_indirect)
beb904
 				ap->ioctlfd = fd;
beb904
-			else
beb904
+			else {
beb904
+				if (type == t_offset &&
beb904
+				    !is_mounted(me->key, MNTS_REAL)) {
beb904
+					ops->close(ap->logopt, fd);
beb904
+					fd = -1;
beb904
+				}
beb904
 				me->ioctlfd = fd;
beb904
+			}
beb904
 			return 1;
beb904
 		}
beb904