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

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