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