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(-) --- autofs-5.1.9.orig/CHANGELOG +++ autofs-5.1.9/CHANGELOG @@ -8,6 +8,7 @@ - fix deadlock in remount. - 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. --- autofs-5.1.9.orig/lib/mounts.c +++ autofs-5.1.9/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;