|
|
96dc52 |
autofs-5.1.7 - move amd mounts removal into lib/mounts.c
|
|
|
96dc52 |
|
|
|
96dc52 |
From: Ian Kent <raven@themaw.net>
|
|
|
96dc52 |
|
|
|
96dc52 |
Move the amd mounts removal from master_free_autofs_point() into
|
|
|
96dc52 |
lib/mounts.c along with the rest of the amd mount handling.
|
|
|
96dc52 |
|
|
|
96dc52 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
96dc52 |
---
|
|
|
96dc52 |
CHANGELOG | 1 +
|
|
|
96dc52 |
daemon/master.c | 12 +-----------
|
|
|
96dc52 |
include/mounts.h | 1 +
|
|
|
96dc52 |
lib/mounts.c | 28 ++++++++++++++++++++++++----
|
|
|
96dc52 |
4 files changed, 27 insertions(+), 15 deletions(-)
|
|
|
96dc52 |
|
|
|
96dc52 |
diff --git a/CHANGELOG b/CHANGELOG
|
|
|
96dc52 |
index 002da042..a9209755 100644
|
|
|
96dc52 |
--- a/CHANGELOG
|
|
|
96dc52 |
+++ b/CHANGELOG
|
|
|
96dc52 |
@@ -46,6 +46,7 @@
|
|
|
96dc52 |
- use mount_fullpath() in one spot in parse_mount().
|
|
|
96dc52 |
- pass root length to mount_fullpath().
|
|
|
96dc52 |
- remove unused function master_submount_list_empty().
|
|
|
96dc52 |
+- move amd mounts removal into lib/mounts.c.
|
|
|
96dc52 |
|
|
|
96dc52 |
25/01/2021 autofs-5.1.7
|
|
|
96dc52 |
- make bind mounts propagation slave by default.
|
|
|
96dc52 |
diff --git a/daemon/master.c b/daemon/master.c
|
|
|
96dc52 |
index af9cd79f..b288e070 100644
|
|
|
96dc52 |
--- a/daemon/master.c
|
|
|
96dc52 |
+++ b/daemon/master.c
|
|
|
96dc52 |
@@ -143,22 +143,12 @@ int master_add_autofs_point(struct master_mapent *entry, unsigned logopt,
|
|
|
96dc52 |
|
|
|
96dc52 |
void master_free_autofs_point(struct autofs_point *ap)
|
|
|
96dc52 |
{
|
|
|
96dc52 |
- struct list_head *p, *head;
|
|
|
96dc52 |
int status;
|
|
|
96dc52 |
|
|
|
96dc52 |
if (!ap)
|
|
|
96dc52 |
return;
|
|
|
96dc52 |
|
|
|
96dc52 |
- mounts_mutex_lock(ap);
|
|
|
96dc52 |
- head = &ap->amdmounts;
|
|
|
96dc52 |
- p = head->next;
|
|
|
96dc52 |
- while (p != head) {
|
|
|
96dc52 |
- struct mnt_list *mnt = list_entry(p, struct mnt_list, amdmount);
|
|
|
96dc52 |
- p = p->next;
|
|
|
96dc52 |
- ext_mount_remove(mnt->ext_mp);
|
|
|
96dc52 |
- mnts_remove_amdmount(mnt->mp);
|
|
|
96dc52 |
- }
|
|
|
96dc52 |
- mounts_mutex_unlock(ap);
|
|
|
96dc52 |
+ mnts_remove_amdmounts(ap);
|
|
|
96dc52 |
|
|
|
96dc52 |
status = pthread_mutex_destroy(&ap->mounts_mutex);
|
|
|
96dc52 |
if (status)
|
|
|
96dc52 |
diff --git a/include/mounts.h b/include/mounts.h
|
|
|
96dc52 |
index d7980976..1b376b3d 100644
|
|
|
96dc52 |
--- a/include/mounts.h
|
|
|
96dc52 |
+++ b/include/mounts.h
|
|
|
96dc52 |
@@ -161,6 +161,7 @@ void mnts_remove_submount(const char *mp);
|
|
|
96dc52 |
struct mnt_list *mnts_find_amdmount(const char *path);
|
|
|
96dc52 |
struct mnt_list *mnts_add_amdmount(struct autofs_point *ap, struct amd_entry *entry);
|
|
|
96dc52 |
void mnts_remove_amdmount(const char *mp);
|
|
|
96dc52 |
+void mnts_remove_amdmounts(struct autofs_point *ap);
|
|
|
96dc52 |
struct mnt_list *mnts_add_mount(struct autofs_point *ap, const char *name, unsigned int flags);
|
|
|
96dc52 |
void mnts_remove_mount(const char *mp, unsigned int flags);
|
|
|
96dc52 |
struct mnt_list *get_mnt_list(const char *path, int include);
|
|
|
96dc52 |
diff --git a/lib/mounts.c b/lib/mounts.c
|
|
|
96dc52 |
index 6b8e4c92..c8a7bf00 100644
|
|
|
96dc52 |
--- a/lib/mounts.c
|
|
|
96dc52 |
+++ b/lib/mounts.c
|
|
|
96dc52 |
@@ -1144,14 +1144,13 @@ fail:
|
|
|
96dc52 |
return NULL;
|
|
|
96dc52 |
}
|
|
|
96dc52 |
|
|
|
96dc52 |
-void mnts_remove_amdmount(const char *mp)
|
|
|
96dc52 |
+static void __mnts_remove_amdmount(const char *mp)
|
|
|
96dc52 |
{
|
|
|
96dc52 |
struct mnt_list *this;
|
|
|
96dc52 |
|
|
|
96dc52 |
- mnts_hash_mutex_lock();
|
|
|
96dc52 |
this = mnts_lookup(mp);
|
|
|
96dc52 |
if (!(this && this->flags & MNTS_AMD_MOUNT))
|
|
|
96dc52 |
- goto done;
|
|
|
96dc52 |
+ return;
|
|
|
96dc52 |
this->flags &= ~MNTS_AMD_MOUNT;
|
|
|
96dc52 |
list_del_init(&this->amdmount);
|
|
|
96dc52 |
if (this->ext_mp) {
|
|
|
96dc52 |
@@ -1172,7 +1171,28 @@ void mnts_remove_amdmount(const char *mp)
|
|
|
96dc52 |
}
|
|
|
96dc52 |
this->amd_cache_opts = 0;
|
|
|
96dc52 |
__mnts_put_mount(this);
|
|
|
96dc52 |
-done:
|
|
|
96dc52 |
+}
|
|
|
96dc52 |
+
|
|
|
96dc52 |
+void mnts_remove_amdmount(const char *mp)
|
|
|
96dc52 |
+{
|
|
|
96dc52 |
+ mnts_hash_mutex_lock();
|
|
|
96dc52 |
+ __mnts_remove_amdmount(mp);
|
|
|
96dc52 |
+ mnts_hash_mutex_unlock();
|
|
|
96dc52 |
+}
|
|
|
96dc52 |
+
|
|
|
96dc52 |
+void mnts_remove_amdmounts(struct autofs_point *ap)
|
|
|
96dc52 |
+{
|
|
|
96dc52 |
+ struct list_head *head, *p;
|
|
|
96dc52 |
+
|
|
|
96dc52 |
+ mnts_hash_mutex_lock();
|
|
|
96dc52 |
+ head = &ap->amdmounts;
|
|
|
96dc52 |
+ p = head->next;
|
|
|
96dc52 |
+ while (p != head) {
|
|
|
96dc52 |
+ struct mnt_list *mnt = list_entry(p, struct mnt_list, amdmount);
|
|
|
96dc52 |
+ p = p->next;
|
|
|
96dc52 |
+ ext_mount_remove(mnt->ext_mp);
|
|
|
96dc52 |
+ __mnts_remove_amdmount(mnt->mp);
|
|
|
96dc52 |
+ }
|
|
|
96dc52 |
mnts_hash_mutex_unlock();
|
|
|
96dc52 |
}
|
|
|
96dc52 |
|