autofs-5.1.9 - don't free ext mount if mounted From: Ian Kent If an external mount is in use when a umount is attempted don't free it just let the reference count go to zero. This will leave the mount in place and it won't get umounted. But if another automount uses it it's reference count will become no zero allowing for it to be umounted as normal if it isn't in use during automount expire. Signed-off-by: Ian Kent --- CHANGELOG | 1 + lib/mounts.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e7c78f989..07d1e3804 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ - fix always recreate credential cache. - fix amd external mount error handling. - fix amd external mount mount handling. +- don't free ext mount if mounted. 02/11/2023 autofs-5.1.9 - fix kernel mount status notification. diff --git a/lib/mounts.c b/lib/mounts.c index 7680c59c1..9a12dbf2f 100644 --- a/lib/mounts.c +++ b/lib/mounts.c @@ -889,10 +889,10 @@ int ext_mount_remove(const char *path) if (!em) goto done; - em->ref--; if (em->ref) - goto done; - else { + em->ref--; + + if (!em->ref && !is_mounted(path, MNTS_REAL)) { hlist_del_init(&em->mount); free(em->mp); if (em->umount) @@ -914,7 +914,7 @@ int ext_mount_inuse(const char *path) em = ext_mount_lookup(path); if (!em) goto done; - ret = em->ref; + ret = 1; done: ext_mount_hash_mutex_unlock(); return ret;