Ian Kent b160ae
autofs-5.1.0 - fix hosts map update on reload
Ian Kent b160ae
Ian Kent b160ae
From: Ian Kent <ikent@redhat.com>
Ian Kent b160ae
Ian Kent b160ae
Commit aedfd5aa - "amd lookup fix host mount naming" introduced a
Ian Kent b160ae
regression when updating sun format maps.
Ian Kent b160ae
Ian Kent b160ae
The amd host mount type assumes the lookup name is the host name for
Ian Kent b160ae
the host mount but amd uses ${rhost} for this.
Ian Kent b160ae
Ian Kent b160ae
This introduces the possibility of multiple concurrent mount requests
Ian Kent b160ae
since constructing a mount tree that isn't under the lookup name can't
Ian Kent b160ae
take advantage of the kernel queuing of other concurrent lookups while
Ian Kent b160ae
the mount tree is constructed.
Ian Kent b160ae
Ian Kent b160ae
Consequently multi-mount updates (currently only done for the internal
Ian Kent b160ae
hosts map which the amd parser also uses for its hosts map) can't be
Ian Kent b160ae
allowed for amd mounts.
Ian Kent b160ae
---
Ian Kent b160ae
 CHANGELOG           |    1 +
Ian Kent b160ae
 modules/parse_sun.c |   37 ++++++++++++++++++++++++++++---------
Ian Kent b160ae
 2 files changed, 29 insertions(+), 9 deletions(-)
Ian Kent b160ae
Ian Kent b160ae
diff --git a/CHANGELOG b/CHANGELOG
Ian Kent b160ae
index 645efe5..59f2906 100644
Ian Kent b160ae
--- a/CHANGELOG
Ian Kent b160ae
+++ b/CHANGELOG
Ian Kent b160ae
@@ -36,6 +36,7 @@
Ian Kent b160ae
 - fix fix master map type check.
Ian Kent b160ae
 - init qdn before use in get_query_dn().
Ian Kent b160ae
 - fix typo in update_hosts_mounts().
Ian Kent b160ae
+- fix hosts map update on reload.
Ian Kent b160ae
 
Ian Kent b160ae
 04/06/2014 autofs-5.1.0
Ian Kent b160ae
 =======================
Ian Kent b160ae
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
Ian Kent b160ae
index b881ee9..a3c736e 100644
Ian Kent b160ae
--- a/modules/parse_sun.c
Ian Kent b160ae
+++ b/modules/parse_sun.c
Ian Kent b160ae
@@ -1356,16 +1356,35 @@ int parse_mount(struct autofs_point *ap, const char *name,
Ian Kent b160ae
 		}
Ian Kent b160ae
 
Ian Kent b160ae
 		cache_multi_writelock(me);
Ian Kent b160ae
-		/* Someone beat us to it, return success */
Ian Kent b160ae
-		if (me->multi) {
Ian Kent b160ae
-			free(options);
Ian Kent b160ae
-			cache_multi_unlock(me);
Ian Kent b160ae
-			cache_unlock(mc);
Ian Kent b160ae
-			pthread_setcancelstate(cur_state, NULL);
Ian Kent b160ae
-			return 0;
Ian Kent b160ae
-		}
Ian Kent b160ae
 		/* So we know we're the multi-mount root */
Ian Kent b160ae
-		me->multi = me;
Ian Kent b160ae
+		if (!me->multi)
Ian Kent b160ae
+			me->multi = me;
Ian Kent b160ae
+		else {
Ian Kent b160ae
+			/*
Ian Kent b160ae
+			 * The amd host mount type assumes the lookup name
Ian Kent b160ae
+			 * is the host name for the host mount but amd uses
Ian Kent b160ae
+			 * ${rhost} for this.
Ian Kent b160ae
+			 *
Ian Kent b160ae
+			 * This introduces the possibility of multiple
Ian Kent b160ae
+			 * concurrent mount requests since constructing a
Ian Kent b160ae
+			 * mount tree that isn't under the lookup name can't
Ian Kent b160ae
+			 * take advantage of the kernel queuing of other
Ian Kent b160ae
+			 * concurrent lookups while the mount tree is
Ian Kent b160ae
+			 * constructed.
Ian Kent b160ae
+			 *
Ian Kent b160ae
+			 * Consequently multi-mount updates (currently only
Ian Kent b160ae
+			 * done for the internal hosts map which the amd
Ian Kent b160ae
+			 * parser also uses for its hosts map) can't be
Ian Kent b160ae
+			 * allowed for amd mounts.
Ian Kent b160ae
+			 */
Ian Kent b160ae
+			if (source->flags & MAP_FLAG_FORMAT_AMD) {
Ian Kent b160ae
+				free(options);
Ian Kent b160ae
+				cache_multi_unlock(me);
Ian Kent b160ae
+				cache_unlock(mc);
Ian Kent b160ae
+				pthread_setcancelstate(cur_state, NULL);
Ian Kent b160ae
+				return 0;
Ian Kent b160ae
+			}
Ian Kent b160ae
+		}
Ian Kent b160ae
 
Ian Kent b160ae
 		age = me->age;
Ian Kent b160ae