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

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