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

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