Blame SOURCES/autofs-5.1.0-make-negative-cache-update-consistent-for-all-lookup-modules.patch

4d476f
autofs-5.1.0 - make negative cache update consistent for all lookup modules
4d476f
4d476f
From: Ian Kent <ikent@redhat.com>
4d476f
4d476f
Use common function for negative cache update everywhere to ensure consistency.
4d476f
---
4d476f
 CHANGELOG                |    1 +
4d476f
 modules/lookup_hosts.c   |   14 +-------------
4d476f
 modules/lookup_nisplus.c |   13 +------------
4d476f
 modules/lookup_program.c |   14 +-------------
4d476f
 4 files changed, 4 insertions(+), 38 deletions(-)
4d476f
4d476f
--- autofs-5.0.7.orig/CHANGELOG
4d476f
+++ autofs-5.0.7/CHANGELOG
4d476f
@@ -159,6 +159,7 @@
4d476f
 - fix fix master map type check.
4d476f
 - fix typo in update_hosts_mounts().
4d476f
 - fix hosts map update on reload.
4d476f
+- make negative cache update consistent for all lookup modules.
4d476f
 
4d476f
 25/07/2012 autofs-5.0.7
4d476f
 =======================
4d476f
--- autofs-5.0.7.orig/modules/lookup_hosts.c
4d476f
+++ autofs-5.0.7/modules/lookup_hosts.c
4d476f
@@ -149,22 +149,10 @@ static int do_parse_mount(struct autofs_
4d476f
 	ret = ctxt->parse->parse_mount(ap, name, name_len,
4d476f
 				 mapent, ctxt->parse->context);
4d476f
 	if (ret) {
4d476f
-		time_t now = time(NULL);
4d476f
 		struct mapent_cache *mc = source->mc;
4d476f
-		struct mapent *me;
4d476f
-		int rv = CHE_OK;
4d476f
 
4d476f
 		cache_writelock(mc);
4d476f
-		me = cache_lookup_distinct(mc, name);
4d476f
-		if (me)
4d476f
-			rv = cache_push_mapent(me, NULL);
4d476f
-		else
4d476f
-			rv = cache_update(mc, source, name, NULL, now);
4d476f
-		if (rv != CHE_FAIL) {
4d476f
-			me = cache_lookup_distinct(mc, name);
4d476f
-			if (me)
4d476f
-				me->status = now + ap->negative_timeout;
4d476f
-		}
4d476f
+		cache_update_negative(mc, source, name, ap->negative_timeout);
4d476f
 		cache_unlock(mc);
4d476f
 		return NSS_STATUS_TRYAGAIN;
4d476f
 	}
4d476f
--- autofs-5.0.7.orig/modules/lookup_nisplus.c
4d476f
+++ autofs-5.0.7/modules/lookup_nisplus.c
4d476f
@@ -777,24 +777,13 @@ int lookup_mount(struct autofs_point *ap
4d476f
 	ret = ctxt->parse->parse_mount(ap, key, key_len,
4d476f
 				       mapent, ctxt->parse->context);
4d476f
 	if (ret) {
4d476f
-		time_t now = time(NULL);
4d476f
-		int rv = CHE_OK;
4d476f
-
4d476f
 		free(mapent);
4d476f
 
4d476f
 		/* Don't update negative cache when re-connecting */
4d476f
 		if (ap->flags & MOUNT_FLAG_REMOUNT)
4d476f
 			return NSS_STATUS_TRYAGAIN;
4d476f
 		cache_writelock(mc);
4d476f
-		me = cache_lookup_distinct(mc, key);
4d476f
-		if (me)
4d476f
-			rv = cache_push_mapent(me, NULL);
4d476f
-		else
4d476f
-			rv = cache_update(mc, source, key, NULL, now);
4d476f
-		if (rv != CHE_FAIL) {
4d476f
-			me = cache_lookup_distinct(mc, key);
4d476f
-			me->status = time(NULL) + ap->negative_timeout;
4d476f
-		}
4d476f
+		cache_update_negative(mc, source, key, ap->negative_timeout);
4d476f
 		cache_unlock(mc);
4d476f
 		return NSS_STATUS_TRYAGAIN;
4d476f
 	}
4d476f
--- autofs-5.0.7.orig/modules/lookup_program.c
4d476f
+++ autofs-5.0.7/modules/lookup_program.c
4d476f
@@ -622,20 +622,8 @@ out_free:
4d476f
 		free(mapent);
4d476f
 
4d476f
 	if (ret) {
4d476f
-		time_t now = time(NULL);
4d476f
-		int rv = CHE_OK;
4d476f
-
4d476f
 		cache_writelock(mc);
4d476f
-		me = cache_lookup_distinct(mc, name);
4d476f
-		if (me)
4d476f
-			rv = cache_push_mapent(me, NULL);
4d476f
-		else
4d476f
-			rv = cache_update(mc, source, name, NULL, now);
4d476f
-		if (rv != CHE_FAIL) {
4d476f
-			me = cache_lookup_distinct(mc, name);
4d476f
-			if (me)
4d476f
-				me->status = now + ap->negative_timeout;
4d476f
-		}
4d476f
+		cache_update_negative(mc, source, name, ap->negative_timeout);
4d476f
 		cache_unlock(mc);
4d476f
 		return NSS_STATUS_TRYAGAIN;
4d476f
 	}