Blame SOURCES/autofs-5.1.5-add-ignore-mount-option.patch

8fa62f
autofs-5.1.5 - add ignore mount option
8fa62f
8fa62f
From: Ian Kent <raven@themaw.net>
8fa62f
8fa62f
Add mount option "ignore", if the kernel supports it, as an
8fa62f
indicator to applications to ignore the mount entry.
8fa62f
8fa62f
Signed-off-by: Ian Kent <raven@themaw.net>
8fa62f
---
8fa62f
 CHANGELOG           |    1 +
8fa62f
 daemon/direct.c     |   10 ++++++++++
8fa62f
 daemon/indirect.c   |   10 ++++++++++
8fa62f
 include/automount.h |    3 +++
8fa62f
 lib/master.c        |    4 ++--
8fa62f
 5 files changed, 26 insertions(+), 2 deletions(-)
8fa62f
8fa62f
--- autofs-5.1.4.orig/daemon/direct.c
8fa62f
+++ autofs-5.1.4/daemon/direct.c
8fa62f
@@ -424,6 +424,16 @@ int do_mount_autofs_direct(struct autofs
8fa62f
 				mp->options = tmp;
8fa62f
 			}
8fa62f
 		}
8fa62f
+
8fa62f
+		if ((ap->flags & MOUNT_FLAG_IGNORE) &&
8fa62f
+		    ((get_kver_major() == 5 && get_kver_minor() > 4) ||
8fa62f
+		     (get_kver_major() > 5))) {
8fa62f
+			char *tmp = realloc(mp->options, strlen(mp->options) + 7);
8fa62f
+			if (tmp) {
8fa62f
+				strcat(tmp, ",ignore");
8fa62f
+				mp->options = tmp;
8fa62f
+			}
8fa62f
+		}
8fa62f
 	}
8fa62f
 
8fa62f
 	/* In case the directory doesn't exist, try to mkdir it */
8fa62f
--- autofs-5.1.4.orig/daemon/indirect.c
8fa62f
+++ autofs-5.1.4/daemon/indirect.c
8fa62f
@@ -133,6 +133,16 @@ static int do_mount_autofs_indirect(stru
8fa62f
 		}
8fa62f
 	}
8fa62f
 
8fa62f
+	if ((ap->flags & MOUNT_FLAG_IGNORE) &&
8fa62f
+	    ((get_kver_major() == 5 && get_kver_minor() > 4) ||
8fa62f
+	     (get_kver_major() > 5))) {
8fa62f
+		char *tmp = realloc(options, strlen(options) + 7);
8fa62f
+		if (tmp) {
8fa62f
+			strcat(tmp, ",ignore");
8fa62f
+			options = tmp;
8fa62f
+		}
8fa62f
+	}
8fa62f
+
8fa62f
 	/* In case the directory doesn't exist, try to mkdir it */
8fa62f
 	if (mkdir_path(root, mp_mode) < 0) {
8fa62f
 		if (errno != EEXIST && errno != EROFS) {
8fa62f
--- autofs-5.1.4.orig/include/automount.h
8fa62f
+++ autofs-5.1.4/include/automount.h
8fa62f
@@ -556,6 +556,9 @@ struct kernel_mod_version {
8fa62f
 /* Use strict expire semantics if requested and kernel supports it */
8fa62f
 #define MOUNT_FLAG_STRICTEXPIRE		0x0400
8fa62f
 
8fa62f
+/* Indicator for applications to ignore the mount entry */
8fa62f
+#define MOUNT_FLAG_IGNORE		0x0800
8fa62f
+
8fa62f
 struct autofs_point {
8fa62f
 	pthread_t thid;
8fa62f
 	char *path;			/* Mount point name */
8fa62f
--- autofs-5.1.4.orig/lib/master.c
8fa62f
+++ autofs-5.1.4/lib/master.c
8fa62f
@@ -101,9 +101,9 @@ int master_add_autofs_point(struct maste
8fa62f
 		ap->negative_timeout = global_negative_timeout;
8fa62f
 	ap->exp_timeout = defaults_get_timeout();
8fa62f
 	ap->exp_runfreq = 0;
8fa62f
-	ap->flags = 0;
8fa62f
+	ap->flags = MOUNT_FLAG_IGNORE;
8fa62f
 	if (ghost)
8fa62f
-		ap->flags = MOUNT_FLAG_GHOST;
8fa62f
+		ap->flags |= MOUNT_FLAG_GHOST;
8fa62f
 
8fa62f
 	if (nobind)
8fa62f
 		ap->flags |= MOUNT_FLAG_NOBIND;
8fa62f
--- autofs-5.1.4.orig/CHANGELOG
8fa62f
+++ autofs-5.1.4/CHANGELOG
8fa62f
@@ -60,6 +60,7 @@ xx/xx/2018 autofs-5.1.5
8fa62f
 - remove a couple of old debug messages.
8fa62f
 - fix amd entry memory leak.
8fa62f
 - fix unlink_mount_tree() not umounting mounts.
8fa62f
+- add ignore mount option.
8fa62f
 
8fa62f
 19/12/2017 autofs-5.1.4
8fa62f
 - fix spec file url.