|
|
beb904 |
autofs-5.1.7 - fix amd section mounts map reload
|
|
|
beb904 |
|
|
|
beb904 |
From: Ian Kent <raven@themaw.net>
|
|
|
beb904 |
|
|
|
beb904 |
Master map section mounts (amd format mounts) get umounted on reload.
|
|
|
beb904 |
|
|
|
beb904 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
beb904 |
---
|
|
|
beb904 |
CHANGELOG | 1
|
|
|
beb904 |
daemon/master.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
|
beb904 |
2 files changed, 81 insertions(+), 1 deletion(-)
|
|
|
beb904 |
|
|
|
beb904 |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
beb904 |
+++ autofs-5.1.4/CHANGELOG
|
|
|
beb904 |
@@ -66,6 +66,7 @@
|
|
|
beb904 |
- refactor lookup_prune_one_cache() a bit.
|
|
|
beb904 |
- cater for empty mounts list in mnts_get_expire_list().
|
|
|
beb904 |
- add ext_mount_hash_mutex lock helpers.
|
|
|
beb904 |
+- fix amd section mounts map reload.
|
|
|
beb904 |
|
|
|
beb904 |
xx/xx/2018 autofs-5.1.5
|
|
|
beb904 |
- fix flag file permission.
|
|
|
beb904 |
--- autofs-5.1.4.orig/daemon/master.c
|
|
|
beb904 |
+++ autofs-5.1.4/daemon/master.c
|
|
|
beb904 |
@@ -882,6 +882,83 @@ struct master *master_new(const char *na
|
|
|
beb904 |
return master;
|
|
|
beb904 |
}
|
|
|
beb904 |
|
|
|
beb904 |
+static void master_update_amd_mount_section_mount(struct master *master,
|
|
|
beb904 |
+ const char *path, time_t age)
|
|
|
beb904 |
+{
|
|
|
beb904 |
+ unsigned int m_logopt = master->logopt;
|
|
|
beb904 |
+ struct master_mapent *entry;
|
|
|
beb904 |
+ struct map_source *source;
|
|
|
beb904 |
+ unsigned int loglevel;
|
|
|
beb904 |
+ unsigned int logopt;
|
|
|
beb904 |
+ unsigned int flags;
|
|
|
beb904 |
+ time_t timeout;
|
|
|
beb904 |
+ char *map;
|
|
|
beb904 |
+ char *opts;
|
|
|
beb904 |
+
|
|
|
beb904 |
+ entry = master_find_mapent(master, path);
|
|
|
beb904 |
+ if (!entry)
|
|
|
beb904 |
+ return;
|
|
|
beb904 |
+
|
|
|
beb904 |
+ map = conf_amd_get_map_name(path);
|
|
|
beb904 |
+ if (!map)
|
|
|
beb904 |
+ return;
|
|
|
beb904 |
+
|
|
|
beb904 |
+ /* amd top level mounts have only one map */
|
|
|
beb904 |
+ source = entry->maps;
|
|
|
beb904 |
+ if (strcmp(source->name, map) != 0) {
|
|
|
beb904 |
+ struct map_source *new;
|
|
|
beb904 |
+ char *type;
|
|
|
beb904 |
+ char *argv[2];
|
|
|
beb904 |
+
|
|
|
beb904 |
+ type = conf_amd_get_map_type(path);
|
|
|
beb904 |
+ argv[0] = map;
|
|
|
beb904 |
+ argv[1] = NULL;
|
|
|
beb904 |
+
|
|
|
beb904 |
+ new = master_add_map_source(entry, type, "amd",
|
|
|
beb904 |
+ age, 1, (const char **) argv);
|
|
|
beb904 |
+ if (!new) {
|
|
|
beb904 |
+ error(m_logopt,
|
|
|
beb904 |
+ "failed to add source for amd section mount %s",
|
|
|
beb904 |
+ path);
|
|
|
beb904 |
+ if (type)
|
|
|
beb904 |
+ free(type);
|
|
|
beb904 |
+ goto out;
|
|
|
beb904 |
+ }
|
|
|
beb904 |
+ master_free_map_source(source, 0);
|
|
|
beb904 |
+ entry->maps = new;
|
|
|
beb904 |
+ source = new;
|
|
|
beb904 |
+ if (type)
|
|
|
beb904 |
+ free(type);
|
|
|
beb904 |
+ }
|
|
|
beb904 |
+
|
|
|
beb904 |
+ loglevel = conf_amd_get_log_options();
|
|
|
beb904 |
+ logopt = m_logopt;
|
|
|
beb904 |
+ if (loglevel <= LOG_DEBUG && loglevel > LOG_INFO)
|
|
|
beb904 |
+ logopt = LOGOPT_DEBUG;
|
|
|
beb904 |
+ else if (loglevel <= LOG_INFO && loglevel > LOG_ERR)
|
|
|
beb904 |
+ logopt = LOGOPT_VERBOSE;
|
|
|
beb904 |
+
|
|
|
beb904 |
+ flags = conf_amd_get_flags(path);
|
|
|
beb904 |
+ if (flags & CONF_BROWSABLE_DIRS)
|
|
|
beb904 |
+ entry->ap->flags |= MOUNT_FLAG_GHOST;
|
|
|
beb904 |
+
|
|
|
beb904 |
+ opts = conf_amd_get_map_options(path);
|
|
|
beb904 |
+ if (opts) {
|
|
|
beb904 |
+ if (strstr(opts, "cache:=all"))
|
|
|
beb904 |
+ entry->ap->flags |= MOUNT_FLAG_AMD_CACHE_ALL;
|
|
|
beb904 |
+ free(opts);
|
|
|
beb904 |
+ }
|
|
|
beb904 |
+
|
|
|
beb904 |
+ entry->ap->logopt = logopt;
|
|
|
beb904 |
+
|
|
|
beb904 |
+ timeout = conf_amd_get_dismount_interval(path);
|
|
|
beb904 |
+ set_exp_timeout(entry->ap, source, timeout);
|
|
|
beb904 |
+ source->master_line = 0;
|
|
|
beb904 |
+ entry->age = age;
|
|
|
beb904 |
+out:
|
|
|
beb904 |
+ free(map);
|
|
|
beb904 |
+}
|
|
|
beb904 |
+
|
|
|
beb904 |
static void master_add_amd_mount_section_mounts(struct master *master, time_t age)
|
|
|
beb904 |
{
|
|
|
beb904 |
unsigned int m_logopt = master->logopt;
|
|
|
beb904 |
@@ -916,8 +993,10 @@ static void master_add_amd_mount_section
|
|
|
beb904 |
* master map it's not a duplicate, don't issue
|
|
|
beb904 |
* an error message.
|
|
|
beb904 |
*/
|
|
|
beb904 |
- if (ret == 1)
|
|
|
beb904 |
+ if (ret == 1) {
|
|
|
beb904 |
+ master_update_amd_mount_section_mount(master, path, age);
|
|
|
beb904 |
goto next;
|
|
|
beb904 |
+ }
|
|
|
beb904 |
info(m_logopt,
|
|
|
beb904 |
"amd section mount path conflict, %s ignored",
|
|
|
beb904 |
path);
|