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

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