autofs/SOURCES/autofs-5.1.5-fix-unlink_mou...

137 lines
3.4 KiB
Diff

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