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

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