autofs-5.0.9 - gaurd against incorrect umount return

From: Ian Kent <ikent@redhat.com>

If umount(8) returns a fail but the mount is actually umounted autofs
can incorrectly try reconstruct mount triggers. This can lead to the
automount point becoming unresponsive.
---
 CHANGELOG          |    1 +
 daemon/automount.c |    3 ++-
 lib/mounts.c       |    6 ++++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 0c46499..f14fb1b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -13,6 +13,7 @@
 - fix memory leak in get_exports().
 - fix typo in flagdir configure option.
 - clarify multiple mounts description.
+- gaurd against incorrect umount return.
 
 28/03/2014 autofs-5.0.9
 =======================
diff --git a/daemon/automount.c b/daemon/automount.c
index 03b1b3d..aae1314 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -526,7 +526,8 @@ static int umount_subtree_mounts(struct autofs_point *ap, const char *path, unsi
 	 */
 	if (!is_mm_root && is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) {
 		debug(ap->logopt, "unmounting dir = %s", path);
-		if (umount_ent(ap, path)) {
+		if (umount_ent(ap, path) &&
+		    is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) {
 			warn(ap->logopt, "could not umount dir %s", path);
 			left++;
 		}
diff --git a/lib/mounts.c b/lib/mounts.c
index af78067..1a541fb 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -1872,7 +1872,8 @@ int umount_multi_triggers(struct autofs_point *ap, struct mapent *me, char *root
 		 */
 		if (is_mounted(_PATH_MOUNTED, root, MNTS_REAL)) {
 			info(ap->logopt, "unmounting dir = %s", root);
-			if (umount_ent(ap, root)) {
+			if (umount_ent(ap, root) &&
+			    is_mounted(_PATH_MOUNTED, root, MNTS_REAL)) {
 				if (mount_multi_triggers(ap, me, root, strlen(root), "/") < 0)
 					warn(ap->logopt,
 					     "failed to remount offset triggers");
@@ -1973,7 +1974,8 @@ int clean_stale_multi_triggers(struct autofs_point *ap,
 		 */
 		if (oe->ioctlfd != -1 ||
 		    is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
-			if (umount_ent(ap, oe->key)) {
+			if (umount_ent(ap, oe->key) &&
+			    is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
 				debug(ap->logopt,
 				      "offset %s has active mount, invalidate",
 				      oe->key);
