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