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(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -160,6 +160,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.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/modules/lookup_hosts.c
+++ autofs-5.0.7/modules/lookup_hosts.c
@@ -151,6 +151,9 @@ static int do_parse_mount(struct autofs_
 	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);
--- autofs-5.0.7.orig/modules/lookup_program.c
+++ autofs-5.0.7/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);