Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 156

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

diff --git a/CHANGELOG b/CHANGELOG
index 989b7cb..f8583b8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -46,6 +46,7 @@
 - correct semantics of "-null" map handling.
 - remove ability to use multiple indirect mount entries in master map.
 - expand export access checks to include missing syntax options.
+- make "-hosts" module try to be sensitive to exports list changes.
 
 1/9/2006 autofs-5.0.1 rc2
 -------------------------
diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
index 08ef278..1a16b96 100644
--- a/modules/lookup_hosts.c
+++ b/modules/lookup_hosts.c
@@ -123,7 +123,6 @@ int lookup_mount(struct autofs_point *ap
 	int mapent_len;
 	time_t now = time(NULL);
 	exports exp;
-	int status = NSS_STATUS_UNKNOWN;
 	int ret;
 
 	source = ap->entry->current;
@@ -135,6 +134,7 @@ int lookup_mount(struct autofs_point *ap
 	cache_readlock(mc);
 	me = cache_lookup_distinct(mc, name);
 	if (!me) {
+		cache_unlock(mc);
 		/*
 		 * We haven't read the list of hosts into the
 		 * cache so go straight to the lookup.
@@ -146,12 +146,11 @@ int lookup_mount(struct autofs_point *ap
 			 * so it's NOTFOUND otherwise this could be a
 			 * lookup for a new host.
 			 */
-			if (strchr(name, '/'))
-				status = NSS_STATUS_NOTFOUND;
+			if (*name != '/' && strchr(name, '/'))
+				return NSS_STATUS_NOTFOUND;
 			goto done;
 		}
 
-		pthread_cleanup_push(cache_lock_cleanup, mc);
 		if (*name == '/')
 			msg(MODPREFIX
 			      "can't find path in hosts map %s", name);
@@ -159,8 +158,9 @@ int lookup_mount(struct autofs_point *ap
 			msg(MODPREFIX
 			      "can't find path in hosts map %s/%s",
 			      ap->path, name);
-		pthread_cleanup_pop(0);
-		status = NSS_STATUS_NOTFOUND;
+
+		debug(ap->logopt,
+		      MODPREFIX "lookup failed - update exports list");
 		goto done;
 	}
 	/*
@@ -175,12 +175,8 @@ int lookup_mount(struct autofs_point *ap
 		pthread_cleanup_pop(0);
 		mapent[mapent_len] = '\0';
 	}
-done:
 	cache_unlock(mc);
 
-	if (status != NSS_STATUS_UNKNOWN)
-		return status;
-
 	if (mapent) {
 		master_source_current_wait(ap->entry);
 		ap->entry->current = source;
@@ -190,14 +186,14 @@ done:
 		ret = ctxt->parse->parse_mount(ap, name, name_len,
 				 mapent, ctxt->parse->context);
 
-		if (ret)
-			return NSS_STATUS_TRYAGAIN;
+		if (!ret)
+			return NSS_STATUS_SUCCESS;
 
-		return NSS_STATUS_SUCCESS;
+		debug(ap->logopt, MODPREFIX "mount failed - update exports list");
 	}
-
+done:
 	/*
-	 * Otherwise we need to get the exports list and add then
+	 * Otherwise we need to get the exports list and add update
 	 * the cache.
 	 */
 	debug(ap->logopt, MODPREFIX "fetchng export list for %s", name);
@@ -207,6 +203,7 @@ done:
 	/* Check exports for obvious ones we don't have access to */
 	exp = rpc_exports_prune(exp);
 
+	mapent = NULL;
 	while (exp) {
 		if (mapent) {
 			int len = strlen(mapent) + 1;
@@ -256,9 +253,13 @@ done:
 	cache_update(mc, name, mapent, now);
 	cache_unlock(mc);
 
+	debug(LOGOPT_ANY, "source wait");
+
 	master_source_current_wait(ap->entry);
 	ap->entry->current = source;
 
+	debug(LOGOPT_ANY, "do parse_mount");
+
 	ret = ctxt->parse->parse_mount(ap, name, name_len,
 				 mapent, ctxt->parse->context);
 	free(mapent);