From ae60bb96e7513598470dd41aac962257a0edef5f Mon Sep 17 00:00:00 2001
From: Ian Kent <ikent@redhat.com>
Date: Sat, 30 Jun 2012 09:11:57 +0800
Subject: [PATCH] autofs-5.0.6 - fix remount of multi mount

Went accessing a multi-mount only the the offsets that need to be mounted
are mounted. But when re-mounting multi-mounts during a restart we need to
also traverse into existing mounts and re-connect to triggers mounted within
them.
---
 CHANGELOG    |    1 +
 lib/mounts.c |   15 +++++++++++++++
 2 files changed, 16 insertions(+)

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -36,6 +36,7 @@ Post-5.0.6 patches included in the SUSE
 - syncronize handle_mounts() shutdown.
 - fix syncronize handle_mounts() shutdown.
 - fix offset mount point directory removal.
+- fix remount of multi mount.
 
 28/06/2011 autofs-5.0.6
 -----------------------
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -1492,6 +1492,21 @@ int mount_multi_triggers(struct autofs_p
 			goto cont;
 
 		mounted += do_mount_autofs_offset(ap, oe, root, offset);
+
+		/*
+		 * If re-constructing a multi-mount it's necessary to walk
+		 * into nested mounts, unlike the usual "mount only what's
+		 * needed as you go" behavior.
+		 */
+		if (ap->state == ST_READMAP && ap->flags & MOUNT_FLAG_REMOUNT) {
+			if (oe->ioctlfd != -1 ||
+			    is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
+				char oe_root[PATH_MAX + 1];
+				strcpy(oe_root, root);
+				strcat(oe_root, offset); 
+				mount_multi_triggers(ap, oe, oe_root, strlen(oe_root), base);
+			}
+		}
 cont:
 		offset = cache_get_offset(base,
 				offset, start, &me->multi_list, &pos);
