Blob Blame History Raw
autofs-5.1.7 - fix mnts_get_expire_list() expire list construction

From: Ian Kent <raven@themaw.net>

The mnts_get_expire_list() function is supposed to return an ordered
list of expire candidates but it is not checking the mounted status
of list entries and is returning a larger list than is needed.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG    |    1 +
 lib/mounts.c |    3 +++
 2 files changed, 4 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index f5c5641a..1dded118 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,7 @@
 - refactor umount_multi_triggers().
 - eliminate clean_stale_multi_triggers().
 - simplify mount_subtree() mount check.
+- fix mnts_get_expire_list() expire list construction.
 
 25/01/2021 autofs-5.1.7
 - make bind mounts propagation slave by default.
diff --git a/lib/mounts.c b/lib/mounts.c
index a9abbebf..87813b16 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -1364,6 +1364,9 @@ void mnts_get_expire_list(struct list_head *mnts, struct autofs_point *ap)
 	list_for_each_entry(mnt, &ap->mounts, mount) {
 		struct node *n;
 
+		if (!(mnt->flags & MNTS_MOUNTED))
+			continue;
+
 		__mnts_get_mount(mnt);
 
 		if (!tree) {