|
|
1c5f92 |
autofs-5.1.5 - move unlink_mount_tree() to lib/mounts.c
|
|
|
1c5f92 |
|
|
|
1c5f92 |
From: Ian Kent <raven@themaw.net>
|
|
|
1c5f92 |
|
|
|
1c5f92 |
Both daemon/direct.c and daemon/indirect.c use the same function to
|
|
|
1c5f92 |
lazy umount a list of mounts, move that function to lib/mounts.c.
|
|
|
1c5f92 |
|
|
|
1c5f92 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
1c5f92 |
---
|
|
|
1c5f92 |
CHANGELOG | 1 +
|
|
|
1c5f92 |
daemon/direct.c | 2 --
|
|
|
1c5f92 |
daemon/indirect.c | 34 ----------------------------------
|
|
|
1c5f92 |
include/mounts.h | 1 +
|
|
|
1c5f92 |
lib/mounts.c | 35 +++++++++++++++++++++++++++++++++++
|
|
|
1c5f92 |
5 files changed, 37 insertions(+), 36 deletions(-)
|
|
|
1c5f92 |
|
|
|
1c5f92 |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
1c5f92 |
+++ autofs-5.1.4/CHANGELOG
|
|
|
1c5f92 |
@@ -71,6 +71,7 @@ xx/xx/2018 autofs-5.1.5
|
|
|
1c5f92 |
- refactor unlink_active_mounts() in direct.c.
|
|
|
1c5f92 |
- don't use tree_is_mounted() for mounted checks.
|
|
|
1c5f92 |
- use single unlink_umount_tree() for both direct and indirect mounts.
|
|
|
1c5f92 |
+- move unlink_mount_tree() to lib/mounts.c.
|
|
|
1c5f92 |
|
|
|
1c5f92 |
19/12/2017 autofs-5.1.4
|
|
|
1c5f92 |
- fix spec file url.
|
|
|
1c5f92 |
--- autofs-5.1.4.orig/daemon/direct.c
|
|
|
1c5f92 |
+++ autofs-5.1.4/daemon/direct.c
|
|
|
1c5f92 |
@@ -49,8 +49,6 @@ pthread_key_t key_mnt_direct_params;
|
|
|
1c5f92 |
pthread_key_t key_mnt_offset_params;
|
|
|
1c5f92 |
pthread_once_t key_mnt_params_once = PTHREAD_ONCE_INIT;
|
|
|
1c5f92 |
|
|
|
1c5f92 |
-int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts);
|
|
|
1c5f92 |
-
|
|
|
1c5f92 |
static void key_mnt_params_destroy(void *arg)
|
|
|
1c5f92 |
{
|
|
|
1c5f92 |
struct mnt_params *mp;
|
|
|
1c5f92 |
--- autofs-5.1.4.orig/daemon/indirect.c
|
|
|
1c5f92 |
+++ autofs-5.1.4/daemon/indirect.c
|
|
|
1c5f92 |
@@ -40,40 +40,6 @@
|
|
|
1c5f92 |
/* Attribute to create detached thread */
|
|
|
1c5f92 |
extern pthread_attr_t th_attr_detached;
|
|
|
1c5f92 |
|
|
|
1c5f92 |
-int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts)
|
|
|
1c5f92 |
-{
|
|
|
1c5f92 |
- struct mnt_list *this;
|
|
|
1c5f92 |
- int rv, ret;
|
|
|
1c5f92 |
-
|
|
|
1c5f92 |
- ret = 1;
|
|
|
1c5f92 |
- this = mnts;
|
|
|
1c5f92 |
- while (this) {
|
|
|
1c5f92 |
- if (this->flags & MNTS_AUTOFS)
|
|
|
1c5f92 |
- rv = umount2(this->mp, MNT_DETACH);
|
|
|
1c5f92 |
- else
|
|
|
1c5f92 |
- rv = spawn_umount(ap->logopt, "-l", this->mp, NULL);
|
|
|
1c5f92 |
- if (rv == -1) {
|
|
|
1c5f92 |
- debug(ap->logopt,
|
|
|
1c5f92 |
- "can't unlink %s from mount tree", this->mp);
|
|
|
1c5f92 |
-
|
|
|
1c5f92 |
- switch (errno) {
|
|
|
1c5f92 |
- case EINVAL:
|
|
|
1c5f92 |
- warn(ap->logopt,
|
|
|
1c5f92 |
- "bad superblock or not mounted");
|
|
|
1c5f92 |
- break;
|
|
|
1c5f92 |
-
|
|
|
1c5f92 |
- case ENOENT:
|
|
|
1c5f92 |
- case EFAULT:
|
|
|
1c5f92 |
- ret = 0;
|
|
|
1c5f92 |
- warn(ap->logopt, "bad path for mount");
|
|
|
1c5f92 |
- break;
|
|
|
1c5f92 |
- }
|
|
|
1c5f92 |
- }
|
|
|
1c5f92 |
- this = this->next;
|
|
|
1c5f92 |
- }
|
|
|
1c5f92 |
- return ret;
|
|
|
1c5f92 |
-}
|
|
|
1c5f92 |
-
|
|
|
1c5f92 |
static int do_mount_autofs_indirect(struct autofs_point *ap, const char *root)
|
|
|
1c5f92 |
{
|
|
|
1c5f92 |
const char *str_indirect = mount_type_str(t_indirect);
|
|
|
1c5f92 |
--- autofs-5.1.4.orig/include/mounts.h
|
|
|
1c5f92 |
+++ autofs-5.1.4/include/mounts.h
|
|
|
1c5f92 |
@@ -100,6 +100,7 @@ int ext_mount_add(struct list_head *, co
|
|
|
1c5f92 |
int ext_mount_remove(struct list_head *, const char *);
|
|
|
1c5f92 |
int ext_mount_inuse(const char *);
|
|
|
1c5f92 |
struct mnt_list *get_mnt_list(const char *path, int include);
|
|
|
1c5f92 |
+int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts);
|
|
|
1c5f92 |
void free_mnt_list(struct mnt_list *list);
|
|
|
1c5f92 |
int is_mounted(const char *mp, unsigned int type);
|
|
|
1c5f92 |
void tree_free_mnt_tree(struct mnt_list *tree);
|
|
|
1c5f92 |
--- autofs-5.1.4.orig/lib/mounts.c
|
|
|
1c5f92 |
+++ autofs-5.1.4/lib/mounts.c
|
|
|
1c5f92 |
@@ -881,6 +881,41 @@ local_getmntent_r(FILE *tab, struct mnte
|
|
|
1c5f92 |
return mnt;
|
|
|
1c5f92 |
}
|
|
|
1c5f92 |
|
|
|
1c5f92 |
+int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts)
|
|
|
1c5f92 |
+{
|
|
|
1c5f92 |
+ struct mnt_list *this;
|
|
|
1c5f92 |
+ int rv, ret;
|
|
|
1c5f92 |
+
|
|
|
1c5f92 |
+ ret = 1;
|
|
|
1c5f92 |
+ this = mnts;
|
|
|
1c5f92 |
+ while (this) {
|
|
|
1c5f92 |
+ if (this->flags & MNTS_AUTOFS)
|
|
|
1c5f92 |
+ rv = umount2(this->mp, MNT_DETACH);
|
|
|
1c5f92 |
+ else
|
|
|
1c5f92 |
+ rv = spawn_umount(ap->logopt, "-l", this->mp, NULL);
|
|
|
1c5f92 |
+ if (rv == -1) {
|
|
|
1c5f92 |
+ debug(ap->logopt,
|
|
|
1c5f92 |
+ "can't unlink %s from mount tree", this->mp);
|
|
|
1c5f92 |
+
|
|
|
1c5f92 |
+ switch (errno) {
|
|
|
1c5f92 |
+ case EINVAL:
|
|
|
1c5f92 |
+ warn(ap->logopt,
|
|
|
1c5f92 |
+ "bad superblock or not mounted");
|
|
|
1c5f92 |
+ break;
|
|
|
1c5f92 |
+
|
|
|
1c5f92 |
+ case ENOENT:
|
|
|
1c5f92 |
+ case EFAULT:
|
|
|
1c5f92 |
+ ret = 0;
|
|
|
1c5f92 |
+ warn(ap->logopt, "bad path for mount");
|
|
|
1c5f92 |
+ break;
|
|
|
1c5f92 |
+ }
|
|
|
1c5f92 |
+ }
|
|
|
1c5f92 |
+ this = this->next;
|
|
|
1c5f92 |
+ }
|
|
|
1c5f92 |
+
|
|
|
1c5f92 |
+ return ret;
|
|
|
1c5f92 |
+}
|
|
|
1c5f92 |
+
|
|
|
1c5f92 |
/*
|
|
|
1c5f92 |
* Get list of mounts under path in longest->shortest order
|
|
|
1c5f92 |
*/
|