Blame SOURCES/autofs-5.1.0-guard-against-incorrect-umount-return.patch

019928
autofs-5.1.0 - guard against incorrect umount return
019928
019928
From: Ian Kent <ikent@redhat.com>
019928
019928
If umount(8) returns a fail but the mount is actually umounted autofs
019928
can incorrectly try reconstruct mount triggers. This can lead to the
019928
automount point becoming unresponsive.
019928
---
019928
 CHANGELOG          |    1 +
019928
 daemon/automount.c |    3 ++-
019928
 lib/mounts.c       |    6 ++++--
019928
 3 files changed, 7 insertions(+), 3 deletions(-)
019928
019928
--- autofs-5.0.7.orig/CHANGELOG
019928
+++ autofs-5.0.7/CHANGELOG
019928
@@ -184,6 +184,7 @@
019928
 - fix out of order call in program map lookup.
019928
 - make service want network-online.
019928
 - add remote-fs.target systemd dependency.
019928
+- gaurd against incorrect umount return.
019928
 
019928
 25/07/2012 autofs-5.0.7
019928
 =======================
019928
--- autofs-5.0.7.orig/daemon/automount.c
019928
+++ autofs-5.0.7/daemon/automount.c
019928
@@ -532,7 +532,8 @@ static int umount_subtree_mounts(struct
019928
 	if (!is_mm_root && is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) {
019928
 		struct amd_entry *entry;
019928
 		debug(ap->logopt, "unmounting dir = %s", path);
019928
-		if (umount_ent(ap, path)) {
019928
+		if (umount_ent(ap, path) &&
019928
+		    is_mounted(_PATH_MOUNTED, path, MNTS_REAL)) {
019928
 			warn(ap->logopt, "could not umount dir %s", path);
019928
 			left++;
019928
 			goto done;
019928
--- autofs-5.0.7.orig/lib/mounts.c
019928
+++ autofs-5.0.7/lib/mounts.c
019928
@@ -2126,7 +2126,8 @@ int umount_multi_triggers(struct autofs_
019928
 		 */
019928
 		if (is_mounted(_PATH_MOUNTED, root, MNTS_REAL)) {
019928
 			info(ap->logopt, "unmounting dir = %s", root);
019928
-			if (umount_ent(ap, root)) {
019928
+			if (umount_ent(ap, root) &&
019928
+			    is_mounted(_PATH_MOUNTED, root, MNTS_REAL)) {
019928
 				if (mount_multi_triggers(ap, me, root, strlen(root), "/") < 0)
019928
 					warn(ap->logopt,
019928
 					     "failed to remount offset triggers");
019928
@@ -2227,7 +2228,8 @@ int clean_stale_multi_triggers(struct au
019928
 		 */
019928
 		if (oe->ioctlfd != -1 ||
019928
 		    is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
019928
-			if (umount_ent(ap, oe->key)) {
019928
+			if (umount_ent(ap, oe->key) &&
019928
+			    is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
019928
 				debug(ap->logopt,
019928
 				      "offset %s has active mount, invalidate",
019928
 				      oe->key);