Blame SOURCES/autofs-5.0.7-fix-submount-tree-not-all-expiring.patch

306fa1
autofs-5.0.7 - fix submount tree not all expiring
306fa1
306fa1
From: Ian Kent <ikent@redhat.com>
306fa1
306fa1
Due to the change in the expire-specific-submount-only patch, sub-mounts
306fa1
within an indirect mount that follow a submount (in the check order) won't
306fa1
be expired if that submount is busy.
306fa1
---
306fa1
 CHANGELOG    |    1 +
306fa1
 lib/master.c |   24 +++++++++++++++---------
306fa1
 2 files changed, 16 insertions(+), 9 deletions(-)
306fa1
306fa1
diff --git a/CHANGELOG b/CHANGELOG
306fa1
index f1ec1e5..4106e7f 100644
306fa1
--- a/CHANGELOG
306fa1
+++ b/CHANGELOG
306fa1
@@ -39,6 +39,7 @@
306fa1
 - document browse option in man page.
306fa1
 - fix some automount(8) typos.
306fa1
 - syncronize handle_mounts() shutdown.
306fa1
+- fix submount tree not all expiring.
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
diff --git a/lib/master.c b/lib/master.c
306fa1
index a0e62f2..64dbcb1 100644
306fa1
--- a/lib/master.c
306fa1
+++ b/lib/master.c
306fa1
@@ -905,15 +905,24 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
306fa1
 		this = list_entry(p, struct autofs_point, mounts);
306fa1
 		p = p->prev;
306fa1
 
306fa1
-		if (!master_submount_list_empty(this)) {
306fa1
-			mounts_mutex_unlock(ap);
306fa1
-			return master_notify_submount(this, path, state);
306fa1
-		}
306fa1
-
306fa1
 		/* path not the same */
306fa1
 		if (strcmp(this->path, path))
306fa1
 			continue;
306fa1
 
306fa1
+		if (!master_submount_list_empty(this)) {
306fa1
+			char *this_path = strdup(this->path);
306fa1
+			if (this_path) {
306fa1
+				mounts_mutex_unlock(ap);
306fa1
+				master_notify_submount(this, path, state);
306fa1
+				mounts_mutex_lock(ap);
306fa1
+				if (!__master_find_submount(ap, this_path)) {
306fa1
+					free(this_path);
306fa1
+					continue;
306fa1
+				}
306fa1
+				free(this_path);
306fa1
+			}
306fa1
+		}
306fa1
+
306fa1
 		/* Now we have found the submount we want to expire */
306fa1
 
306fa1
 		st_mutex_lock();
306fa1
@@ -959,10 +968,7 @@ int master_notify_submount(struct autofs_point *ap, const char *path, enum state
306fa1
 			st_mutex_lock();
306fa1
 		}
306fa1
 		st_mutex_unlock();
306fa1
-		mounts_mutex_unlock(ap);
306fa1
-
306fa1
-		return ret;
306fa1
-
306fa1
+		break;
306fa1
 	}
306fa1
 
306fa1
 	mounts_mutex_unlock(ap);