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