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

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