Sophie

Sophie

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

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

autofs-5.0.1 - fix null cache deadlock

From: Ian Kent <ikent@redhat.com>

Reported by Leonardo Chiquitto along with an excelent problem analysis.

When reloading maps that include a combination of direct and indirect
maps it is possible for automount to deadlock due to incorrect lock
ordering.
---

 daemon/state.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


--- autofs-5.0.1.orig/daemon/state.c
+++ autofs-5.0.1/daemon/state.c
@@ -474,11 +474,11 @@ static void *do_readmap(void *arg)
 
 		mnts = tree_make_mnt_tree(_PROC_MOUNTS, "/");
 		pthread_cleanup_push(tree_mnts_cleanup, mnts);
-		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);
+		master_source_readlock(ap->entry);
+		pthread_cleanup_push(master_source_lock_cleanup, ap->entry);
 		map = ap->entry->maps;
 		while (map) {
 			/* Is map source up to date or no longer valid */