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

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