Blob Blame History Raw
autofs-5.1.0 - ensure negative cache isn't updated on remount

From: Ian Kent <ikent@redhat.com>

The negative cache shouldn't be updated when re-connecting at
startup but a couple of lookup modules didn't check for this
case.
---
 CHANGELOG                |    1 +
 modules/lookup_hosts.c   |    3 +++
 modules/lookup_program.c |    3 +++
 3 files changed, 7 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 37b2cde..6903b5d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -38,6 +38,7 @@
 - fix typo in update_hosts_mounts().
 - fix hosts map update on reload.
 - make negative cache update consistent for all lookup modules.
+- ensure negative cache isn't updated on remount.
 
 04/06/2014 autofs-5.1.0
 =======================
diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
index 02bf970..0d48356 100644
--- a/modules/lookup_hosts.c
+++ b/modules/lookup_hosts.c
@@ -151,6 +151,9 @@ static int do_parse_mount(struct autofs_point *ap, struct map_source *source,
 	if (ret) {
 		struct mapent_cache *mc = source->mc;
 
+		/* Don't update negative cache when re-connecting */
+		if (ap->flags & MOUNT_FLAG_REMOUNT)
+			return NSS_STATUS_TRYAGAIN;
 		cache_writelock(mc);
 		cache_update_negative(mc, source, name, ap->negative_timeout);
 		cache_unlock(mc);
diff --git a/modules/lookup_program.c b/modules/lookup_program.c
index bf0e350..8e8fd49 100644
--- a/modules/lookup_program.c
+++ b/modules/lookup_program.c
@@ -622,6 +622,9 @@ out_free:
 		free(mapent);
 
 	if (ret) {
+		/* Don't update negative cache when re-connecting */
+		if (ap->flags & MOUNT_FLAG_REMOUNT)
+			return NSS_STATUS_TRYAGAIN;
 		cache_writelock(mc);
 		cache_update_negative(mc, source, name, ap->negative_timeout);
 		cache_unlock(mc);