Blob Blame History Raw
autofs-5.1.0 - guard 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(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -184,6 +184,7 @@
 - fix out of order call in program map lookup.
 - make service want network-online.
 - add remote-fs.target systemd dependency.
+- gaurd against incorrect umount return.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/daemon/automount.c
+++ autofs-5.0.7/daemon/automount.c
@@ -532,7 +532,8 @@ static int umount_subtree_mounts(struct
 	if (!is_mm_root && is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) {
 		struct amd_entry *entry;
 		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++;
 			goto done;
--- autofs-5.0.7.orig/lib/mounts.c
+++ autofs-5.0.7/lib/mounts.c
@@ -2126,7 +2126,8 @@ int umount_multi_triggers(struct autofs_
 		 */
 		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");
@@ -2227,7 +2228,8 @@ int clean_stale_multi_triggers(struct au
 		 */
 		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);