Ian Kent eb6919
autofs-5.1.0 - ensure negative cache isn't updated on remount
Ian Kent eb6919
Ian Kent eb6919
From: Ian Kent <ikent@redhat.com>
Ian Kent eb6919
Ian Kent eb6919
The negative cache shouldn't be updated when re-connecting at
Ian Kent eb6919
startup but a couple of lookup modules didn't check for this
Ian Kent eb6919
case.
Ian Kent eb6919
---
Ian Kent eb6919
 CHANGELOG                |    1 +
Ian Kent eb6919
 modules/lookup_hosts.c   |    3 +++
Ian Kent eb6919
 modules/lookup_program.c |    3 +++
Ian Kent eb6919
 3 files changed, 7 insertions(+)
Ian Kent eb6919
Ian Kent eb6919
diff --git a/CHANGELOG b/CHANGELOG
Ian Kent eb6919
index 37b2cde..6903b5d 100644
Ian Kent eb6919
--- a/CHANGELOG
Ian Kent eb6919
+++ b/CHANGELOG
Ian Kent eb6919
@@ -38,6 +38,7 @@
Ian Kent eb6919
 - fix typo in update_hosts_mounts().
Ian Kent eb6919
 - fix hosts map update on reload.
Ian Kent eb6919
 - make negative cache update consistent for all lookup modules.
Ian Kent eb6919
+- ensure negative cache isn't updated on remount.
Ian Kent eb6919
 
Ian Kent eb6919
 04/06/2014 autofs-5.1.0
Ian Kent eb6919
 =======================
Ian Kent eb6919
diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c
Ian Kent eb6919
index 02bf970..0d48356 100644
Ian Kent eb6919
--- a/modules/lookup_hosts.c
Ian Kent eb6919
+++ b/modules/lookup_hosts.c
Ian Kent eb6919
@@ -151,6 +151,9 @@ static int do_parse_mount(struct autofs_point *ap, struct map_source *source,
Ian Kent eb6919
 	if (ret) {
Ian Kent eb6919
 		struct mapent_cache *mc = source->mc;
Ian Kent eb6919
 
Ian Kent eb6919
+		/* Don't update negative cache when re-connecting */
Ian Kent eb6919
+		if (ap->flags & MOUNT_FLAG_REMOUNT)
Ian Kent eb6919
+			return NSS_STATUS_TRYAGAIN;
Ian Kent eb6919
 		cache_writelock(mc);
Ian Kent eb6919
 		cache_update_negative(mc, source, name, ap->negative_timeout);
Ian Kent eb6919
 		cache_unlock(mc);
Ian Kent eb6919
diff --git a/modules/lookup_program.c b/modules/lookup_program.c
Ian Kent eb6919
index bf0e350..8e8fd49 100644
Ian Kent eb6919
--- a/modules/lookup_program.c
Ian Kent eb6919
+++ b/modules/lookup_program.c
Ian Kent eb6919
@@ -622,6 +622,9 @@ out_free:
Ian Kent eb6919
 		free(mapent);
Ian Kent eb6919
 
Ian Kent eb6919
 	if (ret) {
Ian Kent eb6919
+		/* Don't update negative cache when re-connecting */
Ian Kent eb6919
+		if (ap->flags & MOUNT_FLAG_REMOUNT)
Ian Kent eb6919
+			return NSS_STATUS_TRYAGAIN;
Ian Kent eb6919
 		cache_writelock(mc);
Ian Kent eb6919
 		cache_update_negative(mc, source, name, ap->negative_timeout);
Ian Kent eb6919
 		cache_unlock(mc);