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

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