autofs-5.1.9 - fix leak with non-strict mount fails From: Ian Kent The default mode when mounting an offset tree of mounts is non-strict meaning fails are ignored so that the tree can be constructed even if exports have been removed from servers. But if this happens a mounted mount entry is still added to allow the tree to be expired away properly except that a umount does not happen and the mounted mount entry remains. Compensate for this by cleaning up any of these when the cache entries for the offset tree are deleted. Signed-off-by: Ian Kent --- CHANGELOG | 1 + lib/mounts.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d397d4c51..c28482277 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -64,6 +64,7 @@ - eliminate master map parameter where possible. - refactor umount_subtree_mounts(). - fix indirect expire's count of remaining mounts. +- fix leak with non-strict mount fails. 02/11/2023 autofs-5.1.9 - fix kernel mount status notification. diff --git a/lib/mounts.c b/lib/mounts.c index 6061f91e5..9e7fbcdd1 100644 --- a/lib/mounts.c +++ b/lib/mounts.c @@ -1740,6 +1740,10 @@ static int tree_mapent_delete_offset_tree(struct tree_node *root) MAPENT_SET_ROOT(me, root); warn(logopt, "failed to delete offset %s", key); } + /* Make sure we cleanup non-strict fails that didn't + * actually have a mount. + */ + mnts_remove_mount(key, MNTS_MOUNTED); free(key); } else { MAPENT_SET_ROOT(me, NULL);