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

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