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

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