Blame SOURCES/autofs-5.1.7-add-some-multi-mount-macros.patch

49b67f
autofs-5.1.7 - add some multi-mount macros
49b67f
49b67f
From: Ian Kent <raven@themaw.net>
49b67f
49b67f
Add convienience macros IS_MM() to check is a mapent is part of a
49b67f
multi-mount, IS_MM_ROOT() to check if a mapent is the root of a
49b67f
multi-mount tree and MM_ROOT() to return the multi-mount root mapent.
49b67f
49b67f
Signed-off-by: Ian Kent <raven@themaw.net>
49b67f
---
49b67f
 CHANGELOG                |    1 +
49b67f
 daemon/automount.c       |   14 +++++++-------
49b67f
 daemon/direct.c          |    6 +++---
49b67f
 daemon/lookup.c          |   10 +++++-----
49b67f
 include/automount.h      |    5 +++++
49b67f
 lib/cache.c              |   30 +++++++++++++++---------------
49b67f
 lib/mounts.c             |   14 +++++++-------
49b67f
 modules/lookup_file.c    |    4 ++--
49b67f
 modules/lookup_hosts.c   |    4 ++--
49b67f
 modules/lookup_ldap.c    |    4 ++--
49b67f
 modules/lookup_nisplus.c |    4 ++--
49b67f
 modules/lookup_program.c |    4 ++--
49b67f
 modules/lookup_sss.c     |    4 ++--
49b67f
 modules/lookup_yp.c      |    4 ++--
49b67f
 modules/parse_sun.c      |   12 ++++++------
49b67f
 15 files changed, 63 insertions(+), 57 deletions(-)
49b67f
49b67f
--- autofs-5.1.4.orig/CHANGELOG
49b67f
+++ autofs-5.1.4/CHANGELOG
49b67f
@@ -28,6 +28,7 @@
49b67f
 - don't pass root to do_mount_autofs_offset().
49b67f
 - rename tree implementation functions.
49b67f
 - fix program map multi-mount lookup after mount fail.
49b67f
+- add some multi-mount macros.
49b67f
 
49b67f
 xx/xx/2018 autofs-5.1.5
49b67f
 - fix flag file permission.
49b67f
--- autofs-5.1.4.orig/daemon/automount.c
49b67f
+++ autofs-5.1.4/daemon/automount.c
49b67f
@@ -545,27 +545,27 @@ static int umount_subtree_mounts(struct
49b67f
 
49b67f
 	if (me) {
49b67f
 		mc = me->mc;
49b67f
-		is_mm_root = (me->multi == me);
49b67f
+		is_mm_root = IS_MM_ROOT(me);
49b67f
 	}
49b67f
 
49b67f
 	left = 0;
49b67f
 
49b67f
-	if (me && me->multi) {
49b67f
+	if (me && IS_MM(me)) {
49b67f
 		char root[PATH_MAX + 1];
49b67f
 		char key[PATH_MAX + 1];
49b67f
 		struct mapent *tmp;
49b67f
 		int status;
49b67f
 		char *base;
49b67f
 
49b67f
-		if (!strchr(me->multi->key, '/'))
49b67f
+		if (!strchr(MM_ROOT(me)->key, '/'))
49b67f
 			/* Indirect multi-mount root */
49b67f
 			/* sprintf okay - if it's mounted, it's
49b67f
 			 * PATH_MAX or less bytes */
49b67f
-			sprintf(root, "%s/%s", ap->path, me->multi->key);
49b67f
+			sprintf(root, "%s/%s", ap->path, MM_ROOT(me)->key);
49b67f
 		else
49b67f
-			strcpy(root, me->multi->key);
49b67f
+			strcpy(root, MM_ROOT(me)->key);
49b67f
 
49b67f
-		if (is_mm_root)
49b67f
+		if (IS_MM_ROOT(me))
49b67f
 			base = NULL;
49b67f
 		else
49b67f
 			base = me->key + strlen(root);
49b67f
@@ -588,7 +588,7 @@ static int umount_subtree_mounts(struct
49b67f
 			return 0;
49b67f
 		}
49b67f
 
49b67f
-		if (!left && is_mm_root) {
49b67f
+		if (!left && IS_MM_ROOT(me)) {
49b67f
 			status = cache_delete_offset_list(mc, me->key);
49b67f
 			if (status != CHE_OK) {
49b67f
 				warn(ap->logopt, "couldn't delete offset list");
49b67f
--- autofs-5.1.4.orig/daemon/direct.c
49b67f
+++ autofs-5.1.4/daemon/direct.c
49b67f
@@ -686,7 +686,7 @@ int mount_autofs_offset(struct autofs_po
49b67f
 			 * a mount that has been automatically mounted by
49b67f
 			 * the kernel NFS client.
49b67f
 			 */
49b67f
-			if (me->multi != me &&
49b67f
+			if (!IS_MM_ROOT(me) &&
49b67f
 			    is_mounted(me->key, MNTS_REAL))
49b67f
 				return MOUNT_OFFSET_IGNORE;
49b67f
 
49b67f
@@ -1220,11 +1220,11 @@ static void *do_mount_direct(void *arg)
49b67f
 			 * for direct mount multi-mounts with no real mount at
49b67f
 			 * their base so they will be expired.
49b67f
 			 */
49b67f
-			if (close_fd && me == me->multi)
49b67f
+			if (close_fd && IS_MM_ROOT(me))
49b67f
 				close_fd = 0;
49b67f
 			if (!close_fd)
49b67f
 				me->ioctlfd = mt.ioctlfd;
49b67f
-			if (me->multi && me->multi != me)
49b67f
+			if (IS_MM(me) && !IS_MM_ROOT(me))
49b67f
 				flags |= MNTS_OFFSET;
49b67f
 		}
49b67f
 		ops->send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token);
49b67f
--- autofs-5.1.4.orig/daemon/lookup.c
49b67f
+++ autofs-5.1.4/daemon/lookup.c
49b67f
@@ -756,7 +756,7 @@ int lookup_ghost(struct autofs_point *ap
49b67f
 					goto next;
49b67f
 
49b67f
 				/* It's a busy multi-mount - leave till next time */
49b67f
-				if (list_empty(&me->multi_list))
49b67f
+				if (IS_MM(me))
49b67f
 					error(ap->logopt,
49b67f
 					      "invalid key %s", me->key);
49b67f
 				goto next;
49b67f
@@ -846,12 +846,12 @@ static int lookup_amd_instance(struct au
49b67f
 	char *m_key;
49b67f
 
49b67f
 	me = cache_lookup_distinct(map->mc, name);
49b67f
-	if (!me || !me->multi) {
49b67f
+	if (!me || !IS_MM(me)) {
49b67f
 		error(ap->logopt, "expected multi mount entry not found");
49b67f
 		return NSS_STATUS_UNKNOWN;
49b67f
 	}
49b67f
 
49b67f
-	m_key = malloc(strlen(ap->path) + strlen(me->multi->key) + 2);
49b67f
+	m_key = malloc(strlen(ap->path) + strlen(MM_ROOT(me)->key) + 2);
49b67f
 	if (!m_key) {
49b67f
 		error(ap->logopt,
49b67f
 		     "failed to allocate storage for search key");
49b67f
@@ -860,7 +860,7 @@ static int lookup_amd_instance(struct au
49b67f
 
49b67f
 	strcpy(m_key, ap->path);
49b67f
 	strcat(m_key, "/");
49b67f
-	strcat(m_key, me->multi->key);
49b67f
+	strcat(m_key, MM_ROOT(me)->key);
49b67f
 
49b67f
 	mnt = mnts_find_amdmount(m_key);
49b67f
 	free(m_key);
49b67f
@@ -1363,7 +1363,7 @@ void lookup_prune_one_cache(struct autof
49b67f
 			 * created on demand and managed by expire and don't
49b67f
 			 * prune the multi-map owner map entry.
49b67f
 			 */
49b67f
-			if (*me->key == '/' || me->multi == me) {
49b67f
+			if (*me->key == '/' || IS_MM_ROOT(me)) {
49b67f
 				me = cache_enumerate(mc, me);
49b67f
 				continue;
49b67f
 			}
49b67f
--- autofs-5.1.4.orig/include/automount.h
49b67f
+++ autofs-5.1.4/include/automount.h
49b67f
@@ -183,6 +183,11 @@ struct mapent {
49b67f
 	ino_t ino;
49b67f
 };
49b67f
 
49b67f
+#define IS_MM(me)	(me->multi)
49b67f
+#define IS_MM_ROOT(me)	(me->multi == me)
49b67f
+#define MM_ROOT(me)	(me->multi)
49b67f
+#define MM_PARENT(me)	(me->parent)
49b67f
+
49b67f
 void cache_lock_cleanup(void *arg);
49b67f
 void cache_readlock(struct mapent_cache *mc);
49b67f
 void cache_writelock(struct mapent_cache *mc);
49b67f
--- autofs-5.1.4.orig/lib/cache.c
49b67f
+++ autofs-5.1.4/lib/cache.c
49b67f
@@ -374,7 +374,7 @@ struct mapent *cache_lookup_first(struct
49b67f
 
49b67f
 		while (me) {
49b67f
 			/* Multi mount entries are not primary */
49b67f
-			if (me->multi && me->multi != me) {
49b67f
+			if (IS_MM(me) && !IS_MM_ROOT(me)) {
49b67f
 				me = me->next;
49b67f
 				continue;
49b67f
 			}
49b67f
@@ -397,7 +397,7 @@ struct mapent *cache_lookup_next(struct
49b67f
 	this = me->next;
49b67f
 	while (this) {
49b67f
 		/* Multi mount entries are not primary */
49b67f
-		if (this->multi && this->multi != this) {
49b67f
+		if (IS_MM(this) && !IS_MM_ROOT(this)) {
49b67f
 			this = this->next;
49b67f
 			continue;
49b67f
 		}
49b67f
@@ -413,7 +413,7 @@ struct mapent *cache_lookup_next(struct
49b67f
 
49b67f
 			while (this) {
49b67f
 				/* Multi mount entries are not primary */
49b67f
-				if (this->multi && this->multi != this) {
49b67f
+				if (IS_MM(this) && !IS_MM_ROOT(this)) {
49b67f
 					this = this->next;
49b67f
 					continue;
49b67f
 				}
49b67f
@@ -435,7 +435,7 @@ struct mapent *cache_lookup_key_next(str
49b67f
 	next = me->next;
49b67f
 	while (next) {
49b67f
 		/* Multi mount entries are not primary */
49b67f
-		if (me->multi && me->multi != me)
49b67f
+		if (IS_MM(me) && !IS_MM_ROOT(me))
49b67f
 			continue;
49b67f
 		if (!strcmp(me->key, next->key))
49b67f
 			return next;
49b67f
@@ -706,7 +706,7 @@ int cache_update_offset(struct mapent_ca
49b67f
 	me = cache_lookup_distinct(mc, key);
49b67f
 	if (me) {
49b67f
 		cache_add_ordered_offset(me, &owner->multi_list);
49b67f
-		me->multi = owner;
49b67f
+		MM_ROOT(me) = owner;
49b67f
 		goto done;
49b67f
 	}
49b67f
 	ret = CHE_FAIL;
49b67f
@@ -784,14 +784,14 @@ int cache_set_offset_parent(struct mapen
49b67f
 	this = cache_lookup_distinct(mc, offset);
49b67f
 	if (!this)
49b67f
 		return 0;
49b67f
-	if (!this->multi)
49b67f
+	if (!IS_MM(this))
49b67f
 		return 0;
49b67f
 
49b67f
 	parent = get_offset_parent(mc, offset);
49b67f
 	if (parent)
49b67f
 		this->parent = parent;
49b67f
 	else
49b67f
-		this->parent = this->multi;
49b67f
+		this->parent = MM_ROOT(this);
49b67f
 
49b67f
 	return 1;
49b67f
 }
49b67f
@@ -849,7 +849,7 @@ int cache_delete_offset(struct mapent_ca
49b67f
 		return CHE_FAIL;
49b67f
 
49b67f
 	if (strcmp(key, me->key) == 0) {
49b67f
-		if (me->multi && me->multi == me)
49b67f
+		if (IS_MM(me) && IS_MM_ROOT(me))
49b67f
 			return CHE_FAIL;
49b67f
 		mc->hash[hashval] = me->next;
49b67f
 		goto delete;
49b67f
@@ -859,7 +859,7 @@ int cache_delete_offset(struct mapent_ca
49b67f
 		pred = me;
49b67f
 		me = me->next;
49b67f
 		if (strcmp(key, me->key) == 0) {
49b67f
-			if (me->multi && me->multi == me)
49b67f
+			if (IS_MM(me) && IS_MM_ROOT(me))
49b67f
 				return CHE_FAIL;
49b67f
 			pred->next = me->next;
49b67f
 			goto delete;
49b67f
@@ -897,7 +897,7 @@ int cache_delete(struct mapent_cache *mc
49b67f
 		me = me->next;
49b67f
 		if (strcmp(key, me->key) == 0) {
49b67f
 			struct stack *s = me->stack;
49b67f
-			if (me->multi && !list_empty(&me->multi_list)) {
49b67f
+			if (IS_MM(me)) {
49b67f
 				ret = CHE_FAIL;
49b67f
 				goto done;
49b67f
 			}
49b67f
@@ -926,7 +926,7 @@ int cache_delete(struct mapent_cache *mc
49b67f
 
49b67f
 	if (strcmp(key, me->key) == 0) {
49b67f
 		struct stack *s = me->stack;
49b67f
-		if (me->multi && !list_empty(&me->multi_list)) {
49b67f
+		if (IS_MM(me)) {
49b67f
 			ret = CHE_FAIL;
49b67f
 			goto done;
49b67f
 		}
49b67f
@@ -965,7 +965,7 @@ int cache_delete_offset_list(struct mape
49b67f
 		return CHE_FAIL;
49b67f
 
49b67f
 	/* Not offset list owner */
49b67f
-	if (me->multi != me)
49b67f
+	if (!IS_MM_ROOT(me))
49b67f
 		return CHE_FAIL;
49b67f
 
49b67f
 	head = &me->multi_list;
49b67f
@@ -986,13 +986,13 @@ int cache_delete_offset_list(struct mape
49b67f
 		this = list_entry(next, struct mapent, multi_list);
49b67f
 		next = next->next;
49b67f
 		list_del_init(&this->multi_list);
49b67f
-		this->multi = NULL;
49b67f
+		MM_ROOT(this) = NULL;
49b67f
 		debug(logopt, "deleting offset key %s", this->key);
49b67f
 		status = cache_delete(mc, this->key);
49b67f
 		if (status == CHE_FAIL) {
49b67f
 			warn(logopt,
49b67f
 			     "failed to delete offset %s", this->key);
49b67f
-			this->multi = me;
49b67f
+			MM_ROOT(this) = me;
49b67f
 			/* TODO: add list back in */
49b67f
 			remain++;
49b67f
 		}
49b67f
@@ -1000,7 +1000,7 @@ int cache_delete_offset_list(struct mape
49b67f
 
49b67f
 	if (!remain) {
49b67f
 		list_del_init(&me->multi_list);
49b67f
-		me->multi = NULL;
49b67f
+		MM_ROOT(me) = NULL;
49b67f
 	}
49b67f
 
49b67f
 	if (remain)
49b67f
--- autofs-5.1.4.orig/lib/mounts.c
49b67f
+++ autofs-5.1.4/lib/mounts.c
49b67f
@@ -2159,7 +2159,7 @@ int try_remount(struct autofs_point *ap,
49b67f
 	} else {
49b67f
 		me->flags &= ~MOUNT_FLAG_DIR_CREATED;
49b67f
 		if (type == t_offset) {
49b67f
-			if (!is_mounted(me->parent->key, MNTS_REAL))
49b67f
+			if (!is_mounted(MM_PARENT(me)->key, MNTS_REAL))
49b67f
 				me->flags |= MOUNT_FLAG_DIR_CREATED;
49b67f
 		}
49b67f
 	}
49b67f
@@ -2306,7 +2306,7 @@ void set_indirect_mount_tree_catatonic(s
49b67f
 				goto next;
49b67f
 
49b67f
 			/* Only need to set offset mounts catatonic */
49b67f
-			if (me->multi && me->multi == me)
49b67f
+			if (IS_MM(me) && IS_MM_ROOT(me))
49b67f
 				set_multi_mount_tree_catatonic(ap, me);
49b67f
 next:
49b67f
 			me = cache_enumerate(mc, me);
49b67f
@@ -2326,7 +2326,7 @@ next:
49b67f
 void set_direct_mount_tree_catatonic(struct autofs_point *ap, struct mapent *me)
49b67f
 {
49b67f
 	/* Set offset mounts catatonic for this mapent */
49b67f
-	if (me->multi && me->multi == me)
49b67f
+	if (IS_MM(me) && IS_MM_ROOT(me))
49b67f
 		set_multi_mount_tree_catatonic(ap, me);
49b67f
 	set_mount_catatonic(ap, me, me->ioctlfd);
49b67f
 }
49b67f
@@ -2484,12 +2484,12 @@ static int rmdir_path_offset(struct auto
49b67f
 	int ret;
49b67f
 
49b67f
 	if (ap->type == LKP_DIRECT)
49b67f
-		return rmdir_path(ap, oe->key, oe->multi->dev);
49b67f
+		return rmdir_path(ap, oe->key, MM_ROOT(oe)->dev);
49b67f
 
49b67f
 	dir = strdup(oe->key);
49b67f
 
49b67f
 	if (ap->flags & MOUNT_FLAG_GHOST)
49b67f
-		split = strlen(ap->path) + strlen(oe->multi->key) + 1;
49b67f
+		split = strlen(ap->path) + strlen(MM_ROOT(oe)->key) + 1;
49b67f
 	else
49b67f
 		split = strlen(ap->path);
49b67f
 
49b67f
@@ -2684,7 +2684,7 @@ int mount_multi_triggers(struct autofs_p
49b67f
 		oe = cache_lookup_distinct(me->mc, key);
49b67f
 		if (!oe || !oe->mapent)
49b67f
 			goto cont;
49b67f
-		if (oe->age != me->multi->age) {
49b67f
+		if (oe->age != MM_ROOT(me)->age) {
49b67f
 			/* Best effort */
49b67f
 			do_umount_offset(ap, oe, root, start);
49b67f
 			goto cont;
49b67f
@@ -2718,7 +2718,7 @@ int umount_multi_triggers(struct autofs_
49b67f
 
49b67f
 	left = do_umount_multi_triggers(ap, me, root, start, base);
49b67f
 
49b67f
-	if (!left && me->multi == me) {
49b67f
+	if (!left && IS_MM_ROOT(me)) {
49b67f
 		/*
49b67f
 		 * Special case.
49b67f
 		 * If we can't umount the root container then we can't
49b67f
--- autofs-5.1.4.orig/modules/lookup_file.c
49b67f
+++ autofs-5.1.4/modules/lookup_file.c
49b67f
@@ -1217,8 +1217,8 @@ int lookup_mount(struct autofs_point *ap
49b67f
 
49b67f
 		cache_readlock(mc);
49b67f
 		me = cache_lookup_distinct(mc, key);
49b67f
-		if (me && me->multi)
49b67f
-			lkp_key = strdup(me->multi->key);
49b67f
+		if (me && IS_MM(me))
49b67f
+			lkp_key = strdup(MM_ROOT(me)->key);
49b67f
 		else if (!ap->pref)
49b67f
 			lkp_key = strdup(key);
49b67f
 		else {
49b67f
--- autofs-5.1.4.orig/modules/lookup_hosts.c
49b67f
+++ autofs-5.1.4/modules/lookup_hosts.c
49b67f
@@ -177,7 +177,7 @@ static void update_hosts_mounts(struct a
49b67f
 	me = cache_lookup_first(mc);
49b67f
 	while (me) {
49b67f
 		/* Hosts map entry not yet expanded or already expired */
49b67f
-		if (!me->multi)
49b67f
+		if (!IS_MM(me))
49b67f
 			goto next;
49b67f
 
49b67f
 		debug(ap->logopt, MODPREFIX "get list of exports for %s", me->key);
49b67f
@@ -200,7 +200,7 @@ next:
49b67f
 		 * Hosts map entry not yet expanded, already expired
49b67f
 		 * or not the base of the tree
49b67f
 		 */
49b67f
-		if (!me->multi || me->multi != me)
49b67f
+		if (!IS_MM(me) || !IS_MM_ROOT(me))
49b67f
 			goto cont;
49b67f
 
49b67f
 		debug(ap->logopt, MODPREFIX
49b67f
--- autofs-5.1.4.orig/modules/lookup_ldap.c
49b67f
+++ autofs-5.1.4/modules/lookup_ldap.c
49b67f
@@ -3718,8 +3718,8 @@ int lookup_mount(struct autofs_point *ap
49b67f
 	if (ap->type == LKP_INDIRECT && *key != '/') {
49b67f
 		cache_readlock(mc);
49b67f
 		me = cache_lookup_distinct(mc, key);
49b67f
-		if (me && me->multi)
49b67f
-			lkp_key = strdup(me->multi->key);
49b67f
+		if (me && IS_MM(me))
49b67f
+			lkp_key = strdup(MM_ROOT(me)->key);
49b67f
 		else if (!ap->pref)
49b67f
 			lkp_key = strdup(key);
49b67f
 		else {
49b67f
--- autofs-5.1.4.orig/modules/lookup_nisplus.c
49b67f
+++ autofs-5.1.4/modules/lookup_nisplus.c
49b67f
@@ -740,8 +740,8 @@ int lookup_mount(struct autofs_point *ap
49b67f
 	if (ap->type == LKP_INDIRECT && *key != '/') {
49b67f
 		cache_readlock(mc);
49b67f
 		me = cache_lookup_distinct(mc, key);
49b67f
-		if (me && me->multi)
49b67f
-			lkp_key = strdup(me->multi->key);
49b67f
+		if (me && IS_MM(me))
49b67f
+			lkp_key = strdup(MM_ROOT(me)->key);
49b67f
 		else if (!ap->pref)
49b67f
 			lkp_key = strdup(key);
49b67f
 		else {
49b67f
--- autofs-5.1.4.orig/modules/lookup_program.c
49b67f
+++ autofs-5.1.4/modules/lookup_program.c
49b67f
@@ -664,7 +664,7 @@ int lookup_mount(struct autofs_point *ap
49b67f
 				 name_len, ent, ctxt->parse->context);
49b67f
 			goto out_free;
49b67f
 		} else {
49b67f
-			if (me->multi && me->multi != me) {
49b67f
+			if (IS_MM(me) && !IS_MM_ROOT(me)) {
49b67f
 				cache_unlock(mc);
49b67f
 				warn(ap->logopt, MODPREFIX
49b67f
 				     "unexpected lookup for active multi-mount"
49b67f
@@ -675,7 +675,7 @@ int lookup_mount(struct autofs_point *ap
49b67f
 			cache_writelock(mc);
49b67f
 			me = cache_lookup_distinct(mc, name);
49b67f
 			if (me) {
49b67f
-				if (me->multi)
49b67f
+				if (IS_MM(me))
49b67f
 					cache_delete_offset_list(mc, name);
49b67f
 				cache_delete(mc, name);
49b67f
 			}
49b67f
--- autofs-5.1.4.orig/modules/lookup_sss.c
49b67f
+++ autofs-5.1.4/modules/lookup_sss.c
49b67f
@@ -1073,8 +1073,8 @@ int lookup_mount(struct autofs_point *ap
49b67f
 
49b67f
 		cache_readlock(mc);
49b67f
 		me = cache_lookup_distinct(mc, key);
49b67f
-		if (me && me->multi)
49b67f
-			lkp_key = strdup(me->multi->key);
49b67f
+		if (me && IS_MM(me))
49b67f
+			lkp_key = strdup(MM_ROOT(me)->key);
49b67f
 		else
49b67f
 			lkp_key = strdup(key);
49b67f
 		cache_unlock(mc);
49b67f
--- autofs-5.1.4.orig/modules/lookup_yp.c
49b67f
+++ autofs-5.1.4/modules/lookup_yp.c
49b67f
@@ -844,8 +844,8 @@ int lookup_mount(struct autofs_point *ap
49b67f
         if (ap->type == LKP_INDIRECT && *key != '/') {
49b67f
 		cache_readlock(mc);
49b67f
 		me = cache_lookup_distinct(mc, key);
49b67f
-		if (me && me->multi)
49b67f
-			lkp_key = strdup(me->multi->key);
49b67f
+		if (me && IS_MM(me))
49b67f
+			lkp_key = strdup(MM_ROOT(me)->key);
49b67f
 		else if (!ap->pref)
49b67f
 			lkp_key = strdup(key);
49b67f
 		else {
49b67f
--- autofs-5.1.4.orig/modules/parse_sun.c
49b67f
+++ autofs-5.1.4/modules/parse_sun.c
49b67f
@@ -1150,7 +1150,7 @@ static int mount_subtree(struct autofs_p
49b67f
 
49b67f
 	rv = 0;
49b67f
 
49b67f
-	mm_key = me->multi->key;
49b67f
+	mm_key = MM_ROOT(me)->key;
49b67f
 
49b67f
 	if (*mm_key == '/') {
49b67f
 		mm_root = mm_key;
49b67f
@@ -1164,7 +1164,7 @@ static int mount_subtree(struct autofs_p
49b67f
 	}
49b67f
 	mm_root_len = strlen(mm_root);
49b67f
 
49b67f
-	if (me == me->multi) {
49b67f
+	if (IS_MM_ROOT(me)) {
49b67f
 		char key[PATH_MAX + 1];
49b67f
 
49b67f
 		if (mm_root_len + 1 > PATH_MAX) {
49b67f
@@ -1181,7 +1181,7 @@ static int mount_subtree(struct autofs_p
49b67f
 
49b67f
 		/* Mount root offset if it exists */
49b67f
 		ro = cache_lookup_distinct(me->mc, key);
49b67f
-		if (ro && ro->age == me->multi->age) {
49b67f
+		if (ro && ro->age == MM_ROOT(me)->age) {
49b67f
 			char *myoptions, *ro_loc;
49b67f
 			int namelen = name ? strlen(name) : 0;
49b67f
 			int ro_len;
49b67f
@@ -1352,7 +1352,7 @@ int parse_mount(struct autofs_point *ap,
49b67f
 	if (*name == '/') {
49b67f
 		cache_readlock(mc);
49b67f
 		me = cache_lookup_distinct(mc, name);
49b67f
-		if (me && me->multi && me->multi != me) {
49b67f
+		if (me && IS_MM(me) && !IS_MM_ROOT(me)) {
49b67f
 			cache_unlock(mc);
49b67f
 			mapent_len = strlen(mapent) + 1;
49b67f
 			pmapent = malloc(mapent_len + 1);
49b67f
@@ -1507,7 +1507,7 @@ dont_expand:
49b67f
 		}
49b67f
 
49b67f
 		/* So we know we're the multi-mount root */
49b67f
-		if (!me->multi)
49b67f
+		if (!IS_MM(me))
49b67f
 			me->multi = me;
49b67f
 		else {
49b67f
 			/*
49b67f
@@ -1632,7 +1632,7 @@ dont_expand:
49b67f
 		 */
49b67f
 		cache_readlock(mc);
49b67f
 		if (*name == '/' &&
49b67f
-		   (me = cache_lookup_distinct(mc, name)) && me->multi) {
49b67f
+		   (me = cache_lookup_distinct(mc, name)) && IS_MM(me)) {
49b67f
 			cache_unlock(mc);
49b67f
 			loc = strdup(p);
49b67f
 			if (!loc) {