Blob Blame History Raw
autofs-5.0.6 - fix remount of multi mount

From: Ian Kent <ikent@redhat.com>

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(+)


--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -55,6 +55,7 @@
 - fix remount deadlock.
 - fix umount recovery of busy direct mount.
 - fix offset mount point directory removal.
+- fix remount of multi mount.
 
 28/06/2011 autofs-5.0.6
 -----------------------
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -1661,6 +1661,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);