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

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