[PATCH 16/32] autofs-5.1.5 - fix unlink_mount_tree() not umounting mounts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At some point a check matching process group id of mounts was added to
the unlink_mount_tree() function so that mounts not matching the group
id of the calling process would be skipped.

But unlink_mount_tree() is meant to force a cleanup of mounts from a
previous automount process so the process group of the current process
can never match so all mounts are skipped.

Signed-off-by: Ian Kent <raven@xxxxxxxxxx>
---
 CHANGELOG         |    1 +
 daemon/direct.c   |    7 -------
 daemon/indirect.c |    9 ---------
 include/mounts.h  |    1 -
 lib/mounts.c      |   20 --------------------
 5 files changed, 1 insertion(+), 37 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index ecfbd2c9..5c255756 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -22,6 +22,7 @@ xx/xx/2019 autofs-5.1.6
 - remove unused function reverse_mnt_list().
 - remove a couple of old debug messages.
 - fix amd entry memory leak.
+- fix unlink_mount_tree() not umounting mounts.
 
 30/10/2018 autofs-5.1.5
 - fix flag file permission.
diff --git a/daemon/direct.c b/daemon/direct.c
index 1c7a9a5c..5b532a53 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -264,10 +264,6 @@ static int unlink_mount_tree(struct autofs_point *ap, struct list_head *list)
 {
 	struct list_head *p;
 	int rv, ret;
-	pid_t pgrp = getpgrp();
-	char spgrp[20];
-
-	sprintf(spgrp, "pgrp=%d", pgrp);
 
 	ret = 1;
 	list_for_each(p, list) {
@@ -275,9 +271,6 @@ static int unlink_mount_tree(struct autofs_point *ap, struct list_head *list)
 
 		mnt = list_entry(p, struct mnt_list, list);
 
-		if (strstr(mnt->opts, spgrp))
-			continue;
-
 		if (strcmp(mnt->fs_type, "autofs"))
 			rv = spawn_umount(ap->logopt, "-l", mnt->path, NULL);
 		else
diff --git a/daemon/indirect.c b/daemon/indirect.c
index e19c0bbf..6f36805f 100644
--- a/daemon/indirect.c
+++ b/daemon/indirect.c
@@ -44,19 +44,10 @@ static int unlink_mount_tree(struct autofs_point *ap, struct mnt_list *mnts)
 {
 	struct mnt_list *this;
 	int rv, ret;
-	pid_t pgrp = getpgrp();
-	char spgrp[20];
-
-	sprintf(spgrp, "pgrp=%d", pgrp);
 
 	ret = 1;
 	this = mnts;
 	while (this) {
-		if (strstr(this->opts, spgrp)) {
-			this = this->next;
-			continue;
-		}
-
 		if (strcmp(this->fs_type, "autofs"))
 			rv = spawn_umount(ap->logopt, "-l", this->path, NULL);
 		else
diff --git a/include/mounts.h b/include/mounts.h
index ec85ae94..0cb4a89a 100644
--- a/include/mounts.h
+++ b/include/mounts.h
@@ -53,7 +53,6 @@ struct mnt_list {
 	char *fs_name;
 	char *fs_type;
 	char *opts;
-	pid_t owner;
 	/*
 	 * List operations ie. get_mnt_list.
 	 */
diff --git a/lib/mounts.c b/lib/mounts.c
index 4bc7a4d2..45f1faa3 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -798,7 +798,6 @@ struct mnt_list *get_mnt_list(const char *table, const char *path, int include)
 	struct mntent *mnt;
 	struct mnt_list *ent, *mptr, *last;
 	struct mnt_list *list = NULL;
-	char *pgrp;
 	size_t len;
 
 	if (!path || !pathlen || pathlen > PATH_MAX)
@@ -879,15 +878,6 @@ struct mnt_list *get_mnt_list(const char *table, const char *path, int include)
 			return NULL;
 		}
 		strcpy(ent->opts, mnt->mnt_opts);
-
-		ent->owner = 0;
-		pgrp = strstr(mnt->mnt_opts, "pgrp=");
-		if (pgrp) {
-			char *end = strchr(pgrp, ',');
-			if (end)
-				*end = '\0';
-			sscanf(pgrp, "pgrp=%d", &ent->owner);
-		}
 	}
 	endmntent(tab);
 
@@ -1068,7 +1058,6 @@ struct mnt_list *tree_make_mnt_tree(const char *table, const char *path)
 	struct mntent *mnt;
 	struct mnt_list *ent, *mptr;
 	struct mnt_list *tree = NULL;
-	char *pgrp;
 	size_t plen;
 	int eq;
 
@@ -1147,15 +1136,6 @@ struct mnt_list *tree_make_mnt_tree(const char *table, const char *path)
 		}
 		strcpy(ent->opts, mnt->mnt_opts);
 
-		ent->owner = 0;
-		pgrp = strstr(mnt->mnt_opts, "pgrp=");
-		if (pgrp) {
-			char *end = strchr(pgrp, ',');
-			if (end)
-				*end = '\0';
-			sscanf(pgrp, "pgrp=%d", &ent->owner);
-		}
-
 		mptr = tree;
 		while (mptr) {
 			int elen = strlen(ent->path);




[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux