diff --git a/CHANGELOG b/CHANGELOG index ffcaacc..bb8b476 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -60,6 +60,7 @@ xx/xx/2018 autofs-5.1.5 - remove a couple of old debug messages. - fix amd entry memory leak. - fix unlink_mount_tree() not umounting mounts. +- add ignore mount option. 19/12/2017 autofs-5.1.4 - fix spec file url. diff --git a/daemon/direct.c b/daemon/direct.c index 28db167..5b532a5 100644 --- a/daemon/direct.c +++ b/daemon/direct.c @@ -424,6 +424,16 @@ int do_mount_autofs_direct(struct autofs_point *ap, mp->options = tmp; } } + + if ((ap->flags & MOUNT_FLAG_IGNORE) && + ((get_kver_major() == 5 && get_kver_minor() > 4) || + (get_kver_major() > 5))) { + char *tmp = realloc(mp->options, strlen(mp->options) + 7); + if (tmp) { + strcat(tmp, ",ignore"); + mp->options = tmp; + } + } } /* In case the directory doesn't exist, try to mkdir it */ diff --git a/daemon/indirect.c b/daemon/indirect.c index 1311f4c..6f36805 100644 --- a/daemon/indirect.c +++ b/daemon/indirect.c @@ -133,6 +133,16 @@ static int do_mount_autofs_indirect(struct autofs_point *ap, const char *root) } } + if ((ap->flags & MOUNT_FLAG_IGNORE) && + ((get_kver_major() == 5 && get_kver_minor() > 4) || + (get_kver_major() > 5))) { + char *tmp = realloc(options, strlen(options) + 7); + if (tmp) { + strcat(tmp, ",ignore"); + options = tmp; + } + } + /* In case the directory doesn't exist, try to mkdir it */ if (mkdir_path(root, mp_mode) < 0) { if (errno != EEXIST && errno != EROFS) { diff --git a/include/automount.h b/include/automount.h index 57cb93f..aa2ffe0 100644 --- a/include/automount.h +++ b/include/automount.h @@ -556,6 +556,9 @@ struct kernel_mod_version { /* Use strict expire semantics if requested and kernel supports it */ #define MOUNT_FLAG_STRICTEXPIRE 0x0400 +/* Indicator for applications to ignore the mount entry */ +#define MOUNT_FLAG_IGNORE 0x0800 + struct autofs_point { pthread_t thid; char *path; /* Mount point name */ diff --git a/lib/master.c b/lib/master.c index 81c3264..f9a65f7 100644 --- a/lib/master.c +++ b/lib/master.c @@ -101,9 +101,9 @@ int master_add_autofs_point(struct master_mapent *entry, unsigned logopt, ap->negative_timeout = global_negative_timeout; ap->exp_timeout = defaults_get_timeout(); ap->exp_runfreq = 0; - ap->flags = 0; + ap->flags = MOUNT_FLAG_IGNORE; if (ghost) - ap->flags = MOUNT_FLAG_GHOST; + ap->flags |= MOUNT_FLAG_GHOST; if (nobind) ap->flags |= MOUNT_FLAG_NOBIND;