Blame SOURCES/autofs-5.1.5-fix-unlink_mount_tree-not-umounting-mounts.patch

8fa62f
autofs-5.1.5 - fix unlink_mount_tree() not umounting mounts
8fa62f
8fa62f
From: Ian Kent <raven@themaw.net>
8fa62f
8fa62f
At some point a check matching process group id of mounts was added to
8fa62f
the unlink_mount_tree() function so that mounts not matching the group
8fa62f
id of the calling process would be skipped.
8fa62f
8fa62f
But unlink_mount_tree() is meant to force a cleanup of mounts from a
8fa62f
previous automount process so the process group of the current process
8fa62f
can never match so all mounts are skipped.
8fa62f
8fa62f
Signed-off-by: Ian Kent <raven@themaw.net>
8fa62f
---
8fa62f
 CHANGELOG         |    1 +
8fa62f
 daemon/direct.c   |    7 -------
8fa62f
 daemon/indirect.c |    9 ---------
8fa62f
 include/mounts.h  |    1 -
8fa62f
 lib/mounts.c      |   20 --------------------
8fa62f
 5 files changed, 1 insertion(+), 37 deletions(-)
8fa62f
8fa62f
--- autofs-5.1.4.orig/CHANGELOG
8fa62f
+++ autofs-5.1.4/CHANGELOG
8fa62f
@@ -59,6 +59,7 @@ xx/xx/2018 autofs-5.1.5
8fa62f
 - remove unused function reverse_mnt_list().
8fa62f
 - remove a couple of old debug messages.
8fa62f
 - fix amd entry memory leak.
8fa62f
+- fix unlink_mount_tree() not umounting mounts.
8fa62f
 
8fa62f
 19/12/2017 autofs-5.1.4
8fa62f
 - fix spec file url.
8fa62f
--- autofs-5.1.4.orig/daemon/direct.c
8fa62f
+++ autofs-5.1.4/daemon/direct.c
8fa62f
@@ -264,10 +264,6 @@ static int unlink_mount_tree(struct auto
8fa62f
 {
8fa62f
 	struct list_head *p;
8fa62f
 	int rv, ret;
8fa62f
-	pid_t pgrp = getpgrp();
8fa62f
-	char spgrp[20];
8fa62f
-
8fa62f
-	sprintf(spgrp, "pgrp=%d", pgrp);
8fa62f
 
8fa62f
 	ret = 1;
8fa62f
 	list_for_each(p, list) {
8fa62f
@@ -275,9 +271,6 @@ static int unlink_mount_tree(struct auto
8fa62f
 
8fa62f
 		mnt = list_entry(p, struct mnt_list, list);
8fa62f
 
8fa62f
-		if (strstr(mnt->opts, spgrp))
8fa62f
-			continue;
8fa62f
-
8fa62f
 		if (strcmp(mnt->fs_type, "autofs"))
8fa62f
 			rv = spawn_umount(ap->logopt, "-l", mnt->path, NULL);
8fa62f
 		else
8fa62f
--- autofs-5.1.4.orig/daemon/indirect.c
8fa62f
+++ autofs-5.1.4/daemon/indirect.c
8fa62f
@@ -44,19 +44,10 @@ static int unlink_mount_tree(struct auto
8fa62f
 {
8fa62f
 	struct mnt_list *this;
8fa62f
 	int rv, ret;
8fa62f
-	pid_t pgrp = getpgrp();
8fa62f
-	char spgrp[20];
8fa62f
-
8fa62f
-	sprintf(spgrp, "pgrp=%d", pgrp);
8fa62f
 
8fa62f
 	ret = 1;
8fa62f
 	this = mnts;
8fa62f
 	while (this) {
8fa62f
-		if (strstr(this->opts, spgrp)) {
8fa62f
-			this = this->next;
8fa62f
-			continue;
8fa62f
-		}
8fa62f
-
8fa62f
 		if (strcmp(this->fs_type, "autofs"))
8fa62f
 			rv = spawn_umount(ap->logopt, "-l", this->path, NULL);
8fa62f
 		else
8fa62f
--- autofs-5.1.4.orig/include/mounts.h
8fa62f
+++ autofs-5.1.4/include/mounts.h
8fa62f
@@ -53,7 +53,6 @@ struct mnt_list {
8fa62f
 	char *fs_name;
8fa62f
 	char *fs_type;
8fa62f
 	char *opts;
8fa62f
-	pid_t owner;
8fa62f
 	/*
8fa62f
 	 * List operations ie. get_mnt_list.
8fa62f
 	 */
8fa62f
--- autofs-5.1.4.orig/lib/mounts.c
8fa62f
+++ autofs-5.1.4/lib/mounts.c
8fa62f
@@ -798,7 +798,6 @@ struct mnt_list *get_mnt_list(const char
8fa62f
 	struct mntent *mnt;
8fa62f
 	struct mnt_list *ent, *mptr, *last;
8fa62f
 	struct mnt_list *list = NULL;
8fa62f
-	char *pgrp;
8fa62f
 	size_t len;
8fa62f
 
8fa62f
 	if (!path || !pathlen || pathlen > PATH_MAX)
8fa62f
@@ -879,15 +878,6 @@ struct mnt_list *get_mnt_list(const char
8fa62f
 			return NULL;
8fa62f
 		}
8fa62f
 		strcpy(ent->opts, mnt->mnt_opts);
8fa62f
-
8fa62f
-		ent->owner = 0;
8fa62f
-		pgrp = strstr(mnt->mnt_opts, "pgrp=");
8fa62f
-		if (pgrp) {
8fa62f
-			char *end = strchr(pgrp, ',');
8fa62f
-			if (end)
8fa62f
-				*end = '\0';
8fa62f
-			sscanf(pgrp, "pgrp=%d", &ent->owner);
8fa62f
-		}
8fa62f
 	}
8fa62f
 	endmntent(tab);
8fa62f
 
8fa62f
@@ -1068,7 +1058,6 @@ struct mnt_list *tree_make_mnt_tree(cons
8fa62f
 	struct mntent *mnt;
8fa62f
 	struct mnt_list *ent, *mptr;
8fa62f
 	struct mnt_list *tree = NULL;
8fa62f
-	char *pgrp;
8fa62f
 	size_t plen;
8fa62f
 	int eq;
8fa62f
 
8fa62f
@@ -1147,15 +1136,6 @@ struct mnt_list *tree_make_mnt_tree(cons
8fa62f
 		}
8fa62f
 		strcpy(ent->opts, mnt->mnt_opts);
8fa62f
 
8fa62f
-		ent->owner = 0;
8fa62f
-		pgrp = strstr(mnt->mnt_opts, "pgrp=");
8fa62f
-		if (pgrp) {
8fa62f
-			char *end = strchr(pgrp, ',');
8fa62f
-			if (end)
8fa62f
-				*end = '\0';
8fa62f
-			sscanf(pgrp, "pgrp=%d", &ent->owner);
8fa62f
-		}
8fa62f
-
8fa62f
 		mptr = tree;
8fa62f
 		while (mptr) {
8fa62f
 			int elen = strlen(ent->path);