|
|
4bca17 |
autofs-5.1.7 - use mapent tree root for tree_mapent_add_node()
|
|
|
4bca17 |
|
|
|
4bca17 |
From: Ian Kent <raven@themaw.net>
|
|
|
4bca17 |
|
|
|
4bca17 |
Since we need to create the offset tree after adding the offset entries
|
|
|
4bca17 |
to the mapent cache lookup the root mapent once and use it when calling
|
|
|
4bca17 |
tree_mapent_add_node() instread of doing a cache lookup on every node
|
|
|
4bca17 |
addition.
|
|
|
4bca17 |
|
|
|
4bca17 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
4bca17 |
---
|
|
|
4bca17 |
CHANGELOG | 1 +
|
|
|
4bca17 |
include/mounts.h | 2 +-
|
|
|
4bca17 |
lib/mounts.c | 24 +++++-------------------
|
|
|
4bca17 |
modules/parse_sun.c | 11 ++++++++++-
|
|
|
4bca17 |
4 files changed, 17 insertions(+), 21 deletions(-)
|
|
|
4bca17 |
|
|
|
4bca17 |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
4bca17 |
+++ autofs-5.1.4/CHANGELOG
|
|
|
4bca17 |
@@ -69,6 +69,7 @@
|
|
|
4bca17 |
- fix amd section mounts map reload.
|
|
|
4bca17 |
- fix amd hosts mount expire.
|
|
|
4bca17 |
- fix offset entries order.
|
|
|
4bca17 |
+- use mapent tree root for tree_mapent_add_node().
|
|
|
4bca17 |
|
|
|
4bca17 |
xx/xx/2018 autofs-5.1.5
|
|
|
4bca17 |
- fix flag file permission.
|
|
|
4bca17 |
--- autofs-5.1.4.orig/include/mounts.h
|
|
|
4bca17 |
+++ autofs-5.1.4/include/mounts.h
|
|
|
4bca17 |
@@ -170,7 +170,7 @@ void mnts_get_expire_list(struct list_he
|
|
|
4bca17 |
void mnts_put_expire_list(struct list_head *mnts);
|
|
|
4bca17 |
void mnts_set_mounted_mount(struct autofs_point *ap, const char *name, unsigned int flags);
|
|
|
4bca17 |
struct tree_node *tree_mapent_root(struct mapent *me);
|
|
|
4bca17 |
-int tree_mapent_add_node(struct mapent_cache *mc, const char *base, const char *key);
|
|
|
4bca17 |
+int tree_mapent_add_node(struct mapent_cache *mc, struct tree_node *root, const char *key);
|
|
|
4bca17 |
int tree_mapent_delete_offsets(struct mapent_cache *mc, const char *key);
|
|
|
4bca17 |
void tree_mapent_cleanup_offsets(struct mapent *oe);
|
|
|
4bca17 |
int tree_mapent_mount_offsets(struct mapent *oe, int nonstrict);
|
|
|
4bca17 |
--- autofs-5.1.4.orig/lib/mounts.c
|
|
|
4bca17 |
+++ autofs-5.1.4/lib/mounts.c
|
|
|
4bca17 |
@@ -1519,27 +1519,13 @@ static void tree_mapent_free(struct tree
|
|
|
4bca17 |
}
|
|
|
4bca17 |
|
|
|
4bca17 |
int tree_mapent_add_node(struct mapent_cache *mc,
|
|
|
4bca17 |
- const char *root, const char *key)
|
|
|
4bca17 |
+ struct tree_node *root, const char *key)
|
|
|
4bca17 |
{
|
|
|
4bca17 |
unsigned int logopt = mc->ap->logopt;
|
|
|
4bca17 |
- struct tree_node *tree, *n;
|
|
|
4bca17 |
- struct mapent *base;
|
|
|
4bca17 |
+ struct tree_node *n;
|
|
|
4bca17 |
struct mapent *parent;
|
|
|
4bca17 |
struct mapent *me;
|
|
|
4bca17 |
|
|
|
4bca17 |
- base = cache_lookup_distinct(mc, root);
|
|
|
4bca17 |
- if (!base) {
|
|
|
4bca17 |
- error(logopt,
|
|
|
4bca17 |
- "failed to find multi-mount root for key %s", key);
|
|
|
4bca17 |
- return 0;
|
|
|
4bca17 |
- }
|
|
|
4bca17 |
-
|
|
|
4bca17 |
- if (MAPENT_ROOT(base) != MAPENT_NODE(base)) {
|
|
|
4bca17 |
- error(logopt, "key %s is not multi-mount root", root);
|
|
|
4bca17 |
- return 0;
|
|
|
4bca17 |
- }
|
|
|
4bca17 |
- tree = MAPENT_ROOT(base);
|
|
|
4bca17 |
-
|
|
|
4bca17 |
me = cache_lookup_distinct(mc, key);
|
|
|
4bca17 |
if (!me) {
|
|
|
4bca17 |
error(logopt,
|
|
|
4bca17 |
@@ -1547,16 +1533,16 @@ int tree_mapent_add_node(struct mapent_c
|
|
|
4bca17 |
return 0;
|
|
|
4bca17 |
}
|
|
|
4bca17 |
|
|
|
4bca17 |
- n = tree_add_node(tree, me);
|
|
|
4bca17 |
+ n = tree_add_node(root, me);
|
|
|
4bca17 |
if (!n)
|
|
|
4bca17 |
return 0;
|
|
|
4bca17 |
|
|
|
4bca17 |
- MAPENT_SET_ROOT(me, tree)
|
|
|
4bca17 |
+ MAPENT_SET_ROOT(me, root)
|
|
|
4bca17 |
|
|
|
4bca17 |
/* Set the subtree parent */
|
|
|
4bca17 |
parent = cache_get_offset_parent(mc, key);
|
|
|
4bca17 |
if (!parent)
|
|
|
4bca17 |
- MAPENT_SET_PARENT(me, tree)
|
|
|
4bca17 |
+ MAPENT_SET_PARENT(me, root)
|
|
|
4bca17 |
else
|
|
|
4bca17 |
MAPENT_SET_PARENT(me, MAPENT_NODE(parent))
|
|
|
4bca17 |
|
|
|
4bca17 |
--- autofs-5.1.4.orig/modules/parse_sun.c
|
|
|
4bca17 |
+++ autofs-5.1.4/modules/parse_sun.c
|
|
|
4bca17 |
@@ -1538,8 +1538,17 @@ dont_expand:
|
|
|
4bca17 |
} while (*p == '/' || (*p == '"' && *(p + 1) == '/'));
|
|
|
4bca17 |
|
|
|
4bca17 |
cache_writelock(mc);
|
|
|
4bca17 |
+ me = cache_lookup_distinct(mc, name);
|
|
|
4bca17 |
+ if (!me) {
|
|
|
4bca17 |
+ cache_unlock(mc);
|
|
|
4bca17 |
+ free(options);
|
|
|
4bca17 |
+ free(pmapent);
|
|
|
4bca17 |
+ cleanup_offset_entries(ap, mc, &offsets);
|
|
|
4bca17 |
+ pthread_setcancelstate(cur_state, NULL);
|
|
|
4bca17 |
+ return 1;
|
|
|
4bca17 |
+ }
|
|
|
4bca17 |
list_for_each_entry_safe(oe, tmp, &offsets, work) {
|
|
|
4bca17 |
- if (!tree_mapent_add_node(mc, name, oe->key))
|
|
|
4bca17 |
+ if (!tree_mapent_add_node(mc, MAPENT_ROOT(me), oe->key))
|
|
|
4bca17 |
error(ap->logopt, "failed to add offset %s to tree", oe->key);
|
|
|
4bca17 |
list_del_init(&oe->work);
|
|
|
4bca17 |
}
|