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