Blame SOURCES/autofs-5.1.6-fix-stale-offset-directories-disable-mount.patch

beb904
autofs-5.1.6 - fix stale offset directories disable mount
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
that are within an autofs mount, the mount point directories are
beb904
incorrectly marked as not created by us when re-connecting to the
beb904
mount so they are not removed at expire.
beb904
beb904
Since the base autofs mount directory needs to be empty for mounts
beb904
to be triggered these directories disable automounting for the mount.
beb904
beb904
Signed-off-by: Ian Kent <raven@themaw.net>
beb904
---
beb904
 CHANGELOG    |    1 +
beb904
 lib/mounts.c |   12 ++++++++++--
beb904
 2 files changed, 11 insertions(+), 2 deletions(-)
beb904
beb904
--- autofs-5.1.4.orig/CHANGELOG
beb904
+++ autofs-5.1.4/CHANGELOG
beb904
@@ -127,6 +127,7 @@ xx/xx/2018 autofs-5.1.5
beb904
 - make umount_autofs() static.
beb904
 - remove force parameter from umount_all().
beb904
 - fix remount expire.
beb904
+- fix stale offset directories disable mount.
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
@@ -2182,15 +2182,23 @@ int try_remount(struct autofs_point *ap,
beb904
 	 * number for the mount but we can't know if we created
beb904
 	 * it or not. However, if this is an indirect mount with
beb904
 	 * the nobrowse option we need to remove the mount point
beb904
-	 * directory at umount anyway.
beb904
+	 * directory at umount anyway. Also, if this is an offset
beb904
+	 * mount that's not within a real mount then we know we
beb904
+	 * created it so we must remove it on expire for the mount
beb904
+	 * to function.
beb904
 	 */
beb904
 	if (type == t_indirect) {
beb904
 		if (ap->flags & MOUNT_FLAG_GHOST)
beb904
 			ap->flags &= ~MOUNT_FLAG_DIR_CREATED;
beb904
 		else
beb904
 			ap->flags |= MOUNT_FLAG_DIR_CREATED;
beb904
-	} else
beb904
+	} else {
beb904
 		me->flags &= ~MOUNT_FLAG_DIR_CREATED;
beb904
+		if (type == t_offset) {
beb904
+			if (!is_mounted(me->parent->key, MNTS_REAL))
beb904
+				me->flags |= MOUNT_FLAG_DIR_CREATED;
beb904
+		}
beb904
+	}
beb904
 
beb904
 	/*
beb904
 	 * Either we opened the mount or we're re-reading the map.