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