Ian Kent cc58c1
autofs-5.0.6 - fix remount of multi mount
Ian Kent cc58c1
Ian Kent cc58c1
From: Ian Kent <ikent@redhat.com>
Ian Kent cc58c1
Ian Kent cc58c1
Went accessing a multi-mount only the the offsets that need to be mounted
Ian Kent cc58c1
are mounted. But when re-mounting multi-mounts during a restart we need to
Ian Kent cc58c1
also traverse into existing mounts and re-connect to triggers mounted within
Ian Kent cc58c1
them.
Ian Kent cc58c1
---
Ian Kent cc58c1
Ian Kent cc58c1
 CHANGELOG    |    1 +
Ian Kent cc58c1
 lib/mounts.c |   15 +++++++++++++++
Ian Kent cc58c1
 2 files changed, 16 insertions(+)
Ian Kent cc58c1
Ian Kent cc58c1
Ian Kent cc58c1
--- autofs-5.0.6.orig/CHANGELOG
Ian Kent cc58c1
+++ autofs-5.0.6/CHANGELOG
Ian Kent cc58c1
@@ -55,6 +55,7 @@
Ian Kent cc58c1
 - fix remount deadlock.
Ian Kent cc58c1
 - fix umount recovery of busy direct mount.
Ian Kent cc58c1
 - fix offset mount point directory removal.
Ian Kent cc58c1
+- fix remount of multi mount.
Ian Kent cc58c1
 
Ian Kent cc58c1
 28/06/2011 autofs-5.0.6
Ian Kent cc58c1
 -----------------------
Ian Kent cc58c1
--- autofs-5.0.6.orig/lib/mounts.c
Ian Kent cc58c1
+++ autofs-5.0.6/lib/mounts.c
Ian Kent cc58c1
@@ -1661,6 +1661,21 @@ int mount_multi_triggers(struct autofs_p
Ian Kent cc58c1
 			goto cont;
Ian Kent cc58c1
 
Ian Kent cc58c1
 		mounted += do_mount_autofs_offset(ap, oe, root, offset);
Ian Kent cc58c1
+
Ian Kent cc58c1
+		/*
Ian Kent cc58c1
+		 * If re-constructing a multi-mount it's necessary to walk
Ian Kent cc58c1
+		 * into nested mounts, unlike the usual "mount only what's
Ian Kent cc58c1
+		 * needed as you go" behavior.
Ian Kent cc58c1
+		 */
Ian Kent cc58c1
+		if (ap->state == ST_READMAP && ap->flags & MOUNT_FLAG_REMOUNT) {
Ian Kent cc58c1
+			if (oe->ioctlfd != -1 ||
Ian Kent cc58c1
+			    is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
Ian Kent cc58c1
+				char oe_root[PATH_MAX + 1];
Ian Kent cc58c1
+				strcpy(oe_root, root);
Ian Kent cc58c1
+				strcat(oe_root, offset); 
Ian Kent cc58c1
+				mount_multi_triggers(ap, oe, oe_root, strlen(oe_root), base);
Ian Kent cc58c1
+			}
Ian Kent cc58c1
+		}
Ian Kent cc58c1
 cont:
Ian Kent cc58c1
 		offset = cache_get_offset(base,
Ian Kent cc58c1
 				offset, start, &me->multi_list, &pos;;