Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 50

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

autofs-5.0.1 - fix direct map cache locking

From: Ian Kent <raven@themaw.net>

Some time during the recent round of updates some locking of the
null map and the direct map entry caches was removed. This patch
adds it back again.
---

 daemon/direct.c |    6 ++++++
 1 file changed, 6 insertions(+)


--- autofs-5.0.1.orig/daemon/direct.c
+++ autofs-5.0.1/daemon/direct.c
@@ -472,6 +472,8 @@ int mount_autofs_direct(struct autofs_po
 	pthread_cleanup_push(master_source_lock_cleanup, ap->entry);
 	master_source_readlock(ap->entry);
 	nc = ap->entry->master->nc;
+	cache_readlock(nc);
+	pthread_cleanup_push(cache_lock_cleanup, nc);
 	map = ap->entry->maps;
 	while (map) {
 		/*
@@ -484,6 +486,8 @@ int mount_autofs_direct(struct autofs_po
 		}
 
 		mc = map->mc;
+		cache_readlock(mc);
+		pthread_cleanup_push(cache_lock_cleanup, mc);
 		me = cache_enumerate(mc, NULL);
 		while (me) {
 			ne = cache_lookup_distinct(nc, me->key);
@@ -511,10 +515,12 @@ int mount_autofs_direct(struct autofs_po
 
 			me = cache_enumerate(mc, me);
 		}
+		pthread_cleanup_pop(1);
 		map = map->next;
 	}
 	pthread_cleanup_pop(1);
 	pthread_cleanup_pop(1);
+	pthread_cleanup_pop(1);
 
 	return 0;
 }