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