File autofs-5.1.0-ensure-negative-cache-isnt-updated-on-remount.patch of Package autofs.3485

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

Index: autofs-5.0.9/modules/lookup_hosts.c
===================================================================
--- autofs-5.0.9.orig/modules/lookup_hosts.c
+++ autofs-5.0.9/modules/lookup_hosts.c
@@ -150,6 +150,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);
Index: autofs-5.0.9/modules/lookup_program.c
===================================================================
--- autofs-5.0.9.orig/modules/lookup_program.c
+++ autofs-5.0.9/modules/lookup_program.c
@@ -448,6 +448,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);