0c223bc
--- util-linux-2.13-pre6/mount/mount.8.subtree	2006-06-12 09:18:26.000000000 +0200
0c223bc
+++ util-linux-2.13-pre6/mount/mount.8	2006-06-12 09:19:43.000000000 +0200
0c223bc
@@ -131,6 +131,41 @@
0c223bc
 .B "mount --move olddir newdir"
0c223bc
 .RE
0c223bc
 
0c223bc
+Since Linux 2.6.15 it is possible to mark a mount and its submounts as shared,
0c223bc
+private, slave or unbindable. A shared mount provides ability to create mirrors
0c223bc
+of that mount such that mounts and umounts within any of the mirrors propagate
0c223bc
+to the other mirror. A slave mount receives propagation from its master, but
0c223bc
+any not vice-versa.  A private mount carries no propagation abilities.  A
0c223bc
+unbindable mount is a private mount which cannot cloned through a bind
0c223bc
+operation. Detailed semantics is documented in Documentation/sharedsubtree.txt
0c223bc
+file in the kernel source tree.
0c223bc
+.RS
0c223bc
+.br
0c223bc
+.B "mount --make-shared mountpoint"
0c223bc
+.br
0c223bc
+.B "mount --make-slave mountpoint"
0c223bc
+.br
0c223bc
+.B "mount --make-private mountpoint"
0c223bc
+.br
0c223bc
+.B "mount --make-unbindable mountpoint"
0c223bc
+.br
0c223bc
+.RE
0c223bc
+
0c223bc
+The following commands allows one to recursively change the type of all the
0c223bc
+mounts under a given mountpoint.
0c223bc
+.RS
0c223bc
+.br
0c223bc
+.B "mount --make-rshared mountpoint"
0c223bc
+.br
0c223bc
+.B "mount --make-rslave mountpoint"
0c223bc
+.br
0c223bc
+.B "mount --make-rprivate mountpoint"
0c223bc
+.br
0c223bc
+.B
0c223bc
+"mount --make-runbindable mountpoint"
0c223bc
+.br
0c223bc
+.RE
0c223bc
+
0c223bc
 The
0c223bc
 .I proc
0c223bc
 file system is not associated with a special device, and when
0c223bc
--- util-linux-2.13-pre6/mount/mount_constants.h.subtree	2002-11-01 01:24:36.000000000 +0100
0c223bc
+++ util-linux-2.13-pre6/mount/mount_constants.h	2006-06-12 09:19:43.000000000 +0200
0c223bc
@@ -57,6 +57,18 @@
0c223bc
 #ifndef MS_VERBOSE
0c223bc
 #define MS_VERBOSE	0x8000	/* 32768 */
0c223bc
 #endif
0c223bc
+#ifndef MS_UNBINDABLE
0c223bc
+#define MS_UNBINDABLE	(1<<17)	/* 131072 unbindable*/
0c223bc
+#endif
0c223bc
+#ifndef MS_PRIVATE
0c223bc
+#define MS_PRIVATE	(1<<18)	/* 262144 Private*/
0c223bc
+#endif
0c223bc
+#ifndef MS_SLAVE
0c223bc
+#define MS_SLAVE	(1<<19)	/* 524288 Slave*/
0c223bc
+#endif
0c223bc
+#ifndef MS_SHARED
0c223bc
+#define MS_SHARED	(1<<20)	/* 1048576 Shared*/
0c223bc
+#endif
0c223bc
 /*
0c223bc
  * Magic mount flag number. Had to be or-ed to the flag values.
0c223bc
  */
0c223bc
--- util-linux-2.13-pre6/mount/mount.c.subtree	2006-06-12 09:18:26.000000000 +0200
0c223bc
+++ util-linux-2.13-pre6/mount/mount.c	2006-06-12 09:19:43.000000000 +0200
0c223bc
@@ -74,7 +74,9 @@
0c223bc
 /* Add volumelabel in a listing of mounted devices (-l). */
0c223bc
 static int list_with_volumelabel = 0;
0c223bc
 
0c223bc
-/* Nonzero for mount {--bind|--replace|--before|--after|--over|--move} */
0c223bc
+/* Nonzero for mount {--bind|--replace|--before|--after|--over|--move|
0c223bc
+ * 		       make-shared|make-private|make-unbindable|make-slave}
0c223bc
+ */
0c223bc
 static int mounttype = 0;
0c223bc
 
0c223bc
 /* True if ruid != euid.  */
0c223bc
@@ -109,6 +111,8 @@
0c223bc
 /* Options that we keep from appearing in the options field in the mtab.  */
0c223bc
 #define MS_NOMTAB	(MS_REMOUNT|MS_NOAUTO|MS_USERS|MS_USER|MS_PAMCONSOLE)
0c223bc
 
0c223bc
+#define MS_PROPAGATION  (MS_SHARED|MS_SLAVE|MS_UNBINDABLE|MS_PRIVATE)
0c223bc
+
0c223bc
 /* Options that we make ordinary users have by default.  */
0c223bc
 #define MS_SECURE	(MS_NOEXEC|MS_NOSUID|MS_NODEV)
0c223bc
 
0c223bc
@@ -346,6 +350,9 @@
0c223bc
 		*flags |= MS_RDONLY;
0c223bc
 	if (readwrite)
0c223bc
 		*flags &= ~MS_RDONLY;
0c223bc
+
0c223bc
+	if (mounttype & MS_PROPAGATION)
0c223bc
+		*flags &= ~MS_BIND;
0c223bc
 	*flags |= mounttype;
0c223bc
 }
0c223bc
 
0c223bc
@@ -916,13 +923,15 @@
0c223bc
       if (loop)
0c223bc
 	  opt_loopdev = loopdev;
0c223bc
 
0c223bc
-      update_mtab_entry(loop ? loopfile : spec,
0c223bc
+      if (!(mounttype & MS_PROPAGATION)) {
0c223bc
+	      update_mtab_entry(loop ? loopfile : spec,
0c223bc
 			node,
0c223bc
 			types ? types : "unknown",
0c223bc
 			fix_opts_string (flags & ~MS_NOMTAB, extra_opts, user),
0c223bc
 			flags,
0c223bc
 			freq,
0c223bc
 			pass);
0c223bc
+      }
0c223bc
 
0c223bc
       block_signals (SIG_UNBLOCK);
0c223bc
       res = 0;
0c223bc
@@ -1461,6 +1470,14 @@
0c223bc
 	{ "move", 0, 0, 133 },
0c223bc
 	{ "guess-fstype", 1, 0, 134 },
0c223bc
 	{ "rbind", 0, 0, 135 },
0c223bc
+	{ "make-shared", 0, 0, 136 },
0c223bc
+	{ "make-slave", 0, 0, 137 },
0c223bc
+	{ "make-private", 0, 0, 138 },
0c223bc
+	{ "make-unbindable", 0, 0, 139 },
0c223bc
+	{ "make-rshared", 0, 0, 140 },
0c223bc
+	{ "make-rslave", 0, 0, 141 },
0c223bc
+	{ "make-rprivate", 0, 0, 142 },
0c223bc
+	{ "make-runbindable", 0, 0, 143 },
0c223bc
 	{ "internal-only", 0, 0, 'i' },
0c223bc
 	{ NULL, 0, 0, 0 }
0c223bc
 };
0c223bc
@@ -1487,6 +1504,17 @@
0c223bc
 	  "       mount --bind olddir newdir\n"
0c223bc
 	  "or move a subtree:\n"
0c223bc
 	  "       mount --move olddir newdir\n"
0c223bc
+	  "One can change the type of mount containing the directory dir:\n"
0c223bc
+	  "       mount --make-shared dir\n"
0c223bc
+	  "       mount --make-slave dir\n"
0c223bc
+	  "       mount --make-private dir\n"
0c223bc
+	  "       mount --make-unbindable dir\n"
0c223bc
+	  "One can change the type of all the mounts in a mount subtree\n"
0c223bc
+	  "containing the directory dir:\n"
0c223bc
+	  "       mount --make-rshared dir\n"
0c223bc
+	  "       mount --make-rslave dir\n"
0c223bc
+	  "       mount --make-rprivate dir\n"
0c223bc
+	  "       mount --make-runbindable dir\n"
0c223bc
 	  "A device can be given by name, say /dev/hda1 or /dev/cdrom,\n"
0c223bc
 	  "or by label, using  -L label  or by uuid, using  -U uuid .\n"
0c223bc
 	  "Other options: [-nfFrsvw] [-o options] [-p passwdfd].\n"
0c223bc
@@ -1638,6 +1666,39 @@
0c223bc
 		case 135:
0c223bc
 			mounttype = (MS_BIND | MS_REC);
0c223bc
 			break;
0c223bc
+
0c223bc
+		case 136:
0c223bc
+			mounttype = MS_SHARED;
0c223bc
+			break;
0c223bc
+
0c223bc
+		case 137:
0c223bc
+			mounttype = MS_SLAVE;
0c223bc
+			break;
0c223bc
+
0c223bc
+		case 138:
0c223bc
+			mounttype = MS_PRIVATE;
0c223bc
+			break;
0c223bc
+
0c223bc
+		case 139:
0c223bc
+			mounttype = MS_UNBINDABLE;
0c223bc
+			break;
0c223bc
+
0c223bc
+		case 140:
0c223bc
+			mounttype = (MS_SHARED | MS_REC);
0c223bc
+			break;
0c223bc
+
0c223bc
+		case 141:
0c223bc
+			mounttype = (MS_SLAVE | MS_REC);
0c223bc
+			break;
0c223bc
+
0c223bc
+		case 142:
0c223bc
+			mounttype = (MS_PRIVATE | MS_REC);
0c223bc
+			break;
0c223bc
+
0c223bc
+		case 143:
0c223bc
+			mounttype = (MS_UNBINDABLE | MS_REC);
0c223bc
+			break;
0c223bc
+
0c223bc
 		case '?':
0c223bc
 		default:
0c223bc
 			usage (stderr, EX_USAGE);