Blame SOURCES/autofs-5.1.7-move-amd-mounts-removal-into-lib_mounts_c.patch

49b67f
autofs-5.1.7 - move amd mounts removal into lib/mounts.c
49b67f
49b67f
From: Ian Kent <raven@themaw.net>
49b67f
49b67f
Move the amd mounts removal from master_free_autofs_point() into
49b67f
lib/mounts.c along with the rest of the amd mount handling.
49b67f
49b67f
Signed-off-by: Ian Kent <raven@themaw.net>
49b67f
---
49b67f
 CHANGELOG        |    1 +
49b67f
 daemon/master.c  |   12 +-----------
49b67f
 include/mounts.h |    1 +
49b67f
 lib/mounts.c     |   28 ++++++++++++++++++++++++----
49b67f
 4 files changed, 27 insertions(+), 15 deletions(-)
49b67f
49b67f
--- autofs-5.1.4.orig/CHANGELOG
49b67f
+++ autofs-5.1.4/CHANGELOG
49b67f
@@ -46,6 +46,7 @@
49b67f
 - use mount_fullpath() in one spot in parse_mount().
49b67f
 - pass root length to mount_fullpath().
49b67f
 - remove unused function master_submount_list_empty().
49b67f
+- move amd mounts removal into lib/mounts.c.
49b67f
 
49b67f
 xx/xx/2018 autofs-5.1.5
49b67f
 - fix flag file permission.
49b67f
--- autofs-5.1.4.orig/daemon/master.c
49b67f
+++ autofs-5.1.4/daemon/master.c
49b67f
@@ -143,22 +143,12 @@ int master_add_autofs_point(struct maste
49b67f
 
49b67f
 void master_free_autofs_point(struct autofs_point *ap)
49b67f
 {
49b67f
-	struct list_head *p, *head;
49b67f
 	int status;
49b67f
 
49b67f
 	if (!ap)
49b67f
 		return;
49b67f
 
49b67f
-	mounts_mutex_lock(ap);
49b67f
-	head = &ap->amdmounts;
49b67f
-	p = head->next;
49b67f
-	while (p != head) {
49b67f
-		struct mnt_list *mnt = list_entry(p, struct mnt_list, amdmount);
49b67f
-		p = p->next;
49b67f
-		ext_mount_remove(mnt->ext_mp);
49b67f
-		mnts_remove_amdmount(mnt->mp);
49b67f
-	}
49b67f
-	mounts_mutex_unlock(ap);
49b67f
+	mnts_remove_amdmounts(ap);
49b67f
 
49b67f
 	status = pthread_mutex_destroy(&ap->mounts_mutex);
49b67f
 	if (status)
49b67f
--- autofs-5.1.4.orig/include/mounts.h
49b67f
+++ autofs-5.1.4/include/mounts.h
49b67f
@@ -161,6 +161,7 @@ void mnts_remove_submount(const char *mp
49b67f
 struct mnt_list *mnts_find_amdmount(const char *path);
49b67f
 struct mnt_list *mnts_add_amdmount(struct autofs_point *ap, struct amd_entry *entry);
49b67f
 void mnts_remove_amdmount(const char *mp);
49b67f
+void mnts_remove_amdmounts(struct autofs_point *ap);
49b67f
 struct mnt_list *mnts_add_mount(struct autofs_point *ap, const char *name, unsigned int flags);
49b67f
 void mnts_remove_mount(const char *mp, unsigned int flags);
49b67f
 struct mnt_list *get_mnt_list(const char *path, int include);
49b67f
--- autofs-5.1.4.orig/lib/mounts.c
49b67f
+++ autofs-5.1.4/lib/mounts.c
49b67f
@@ -1144,14 +1144,13 @@ fail:
49b67f
 	return NULL;
49b67f
 }
49b67f
 
49b67f
-void mnts_remove_amdmount(const char *mp)
49b67f
+static void __mnts_remove_amdmount(const char *mp)
49b67f
 {
49b67f
 	struct mnt_list *this;
49b67f
 
49b67f
-	mnts_hash_mutex_lock();
49b67f
 	this = mnts_lookup(mp);
49b67f
 	if (!(this && this->flags & MNTS_AMD_MOUNT))
49b67f
-		goto done;
49b67f
+		return;
49b67f
 	this->flags &= ~MNTS_AMD_MOUNT;
49b67f
 	list_del_init(&this->amdmount);
49b67f
 	if (this->ext_mp) {
49b67f
@@ -1172,7 +1171,28 @@ void mnts_remove_amdmount(const char *mp
49b67f
 	}
49b67f
 	this->amd_cache_opts = 0;
49b67f
 	__mnts_put_mount(this);
49b67f
-done:
49b67f
+}
49b67f
+
49b67f
+void mnts_remove_amdmount(const char *mp)
49b67f
+{
49b67f
+	mnts_hash_mutex_lock();
49b67f
+	__mnts_remove_amdmount(mp);
49b67f
+	mnts_hash_mutex_unlock();
49b67f
+}
49b67f
+
49b67f
+void mnts_remove_amdmounts(struct autofs_point *ap)
49b67f
+{
49b67f
+	struct list_head *head, *p;
49b67f
+
49b67f
+	mnts_hash_mutex_lock();
49b67f
+	head = &ap->amdmounts;
49b67f
+	p = head->next;
49b67f
+	while (p != head) {
49b67f
+		struct mnt_list *mnt = list_entry(p, struct mnt_list, amdmount);
49b67f
+		p = p->next;
49b67f
+		ext_mount_remove(mnt->ext_mp);
49b67f
+		__mnts_remove_amdmount(mnt->mp);
49b67f
+	}
49b67f
 	mnts_hash_mutex_unlock();
49b67f
 }
49b67f