Blob Blame History Raw
autofs-5.0.4 - library reload fix update fix 2

From: Ian Kent <raven@themaw.net>

The library reload fixes introduced a bug which causes autofs to
not release mount thread resources when using submounts.
---

 CHANGELOG          |    1 +
 daemon/automount.c |   11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index f49784a..d1cc113 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -50,6 +50,7 @@
 - always read file maps multi map fix.
 - always read file maps key lookup fixes.
 - use srv query for domain dn.
+- fix not releasing resources when using submounts.
 
 4/11/2008 autofs-5.0.4
 -----------------------
diff --git a/daemon/automount.c b/daemon/automount.c
index 3a0fe0b..44dcdd6 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -1460,14 +1460,21 @@ static void handle_mounts_cleanup(void *arg)
 	master_remove_mapent(ap->entry);
 	master_source_unlock(ap->entry);
 
+	destroy_logpri_fifo(ap);
+
+	/*
+	 * Submounts are detached threads and don't belong to the
+	 * master map entry list so we need to free their resources
+	 * here.
+	 */
 	if (submount) {
 		mounts_mutex_unlock(ap->parent);
 		master_source_unlock(ap->parent->entry);
+		master_free_mapent_sources(ap->entry, 1);
+		master_free_mapent(ap->entry);
 	}
 	master_mutex_unlock();
 
-	destroy_logpri_fifo(ap);
-
 	if (clean) {
 		if (rmdir(path) == -1) {
 			char *estr = strerror_r(errno, buf, MAX_ERR_BUF);