linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 8/10] vfs: shared subtree aware namespaces
@ 2005-09-16 18:26 Ram
  2005-09-20  7:31 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Ram @ 2005-09-16 18:26 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel
  Cc: linuxram, akpm, viro, miklos, mike, bfields, serue

Patch that help setup the correct propagation for the mounts under the new
cloned namespace.

Signed by Ram Pai (linuxram@us.ibm.com)

 fs/namespace.c        |   14 ++++++++++++++
 fs/pnode.c            |   17 +++++++++++++++++
 include/linux/pnode.h |    1 +
 3 files changed, 32 insertions(+)

Index: 2.6.13.sharedsubtree/fs/namespace.c
===================================================================
--- 2.6.13.sharedsubtree.orig/fs/namespace.c
+++ 2.6.13.sharedsubtree/fs/namespace.c
@@ -1572,11 +1572,22 @@ int copy_namespace(int flags, struct tas
 	 * fs_struct, so tsk->fs->lock is not needed.
 	 */
 	p = namespace->root;
 	q = new_ns->root;
 	while (p) {
+		if (IS_MNT_UNCLONABLE(p)) {
+			p = skip_mnt_tree(p);
+			p = next_mnt(p, namespace->root);
+			continue;
+		}
 		q->mnt_namespace = new_ns;
+		/*
+		 * release the reference to q->mnt_master
+		 * held in clone_mnt()
+		 */
+		mntput(q->mnt_master);
+		copy_propagation(p, q);
 		if (fs) {
 			if (p == fs->rootmnt) {
 				rootmnt = p;
 				fs->rootmnt = mntget(q);
 			}
@@ -1949,14 +1960,17 @@ void __init mnt_init(unsigned long mempa
 }
 
 void __put_namespace(struct namespace *namespace)
 {
 	struct vfsmount *root = namespace->root;
+	struct vfsmount *mnt;
 	namespace->root = NULL;
 	spin_unlock(&vfsmount_lock);
 	down_write(&namespace_sem);
 	spin_lock(&vfsmount_lock);
+	list_for_each_entry(mnt, &namespace->list, mnt_list)
+	    do_make_private(mnt);
 	umount_tree(root);
 	spin_unlock(&vfsmount_lock);
 	up_write(&namespace_sem);
 	kfree(namespace);
 }
Index: 2.6.13.sharedsubtree/fs/pnode.c
===================================================================
--- 2.6.13.sharedsubtree.orig/fs/pnode.c
+++ 2.6.13.sharedsubtree/fs/pnode.c
@@ -175,10 +175,27 @@ void pnode_slave_mount(struct vfsmount *
 	first->mnt_master = second->mnt_master;
 	list_add(&first->mnt_slave, &second->mnt_slave);
 	spin_unlock(&vfspnode_lock);
 }
 
+/*
+ * set up the same propagation for mount @new as
+ * that of mount @old'
+ */
+void copy_propagation(struct vfsmount *old, struct vfsmount *new)
+{
+	spin_lock(&vfspnode_lock);
+	new->mnt_master = NULL;
+	if (IS_MNT_SHARED(old))
+		list_add_tail(&new->mnt_share, &old->mnt_share);
+	else if (IS_MNT_SLAVE(old)) {
+		list_add_tail(&new->mnt_slave, &old->mnt_slave);
+		new->mnt_master = old->mnt_master;
+	}
+	spin_unlock(&vfspnode_lock);
+}
+
 static int check_peer(struct vfsmount *start, struct vfsmount *orig)
 {
 	struct vfsmount *m = start;
 	do {
 		m = next_shared(m);
Index: 2.6.13.sharedsubtree/include/linux/pnode.h
===================================================================
--- 2.6.13.sharedsubtree.orig/include/linux/pnode.h
+++ 2.6.13.sharedsubtree/include/linux/pnode.h
@@ -62,6 +62,7 @@ int propagate_commit_mount(struct vfsmou
 int propagate_abort_mount(struct vfsmount *);
 int propagate_prepare_mount(struct vfsmount *, struct dentry *,
 			    struct vfsmount *);
 int propagate_umount(struct vfsmount *);
 int propagate_mount_busy(struct vfsmount *, int);
+void copy_propagation(struct vfsmount *, struct vfsmount *);
 #endif				/* _LINUX_PNODE_H */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH 8/10] vfs: shared subtree aware namespaces
  2005-09-16 18:26 [RFC PATCH 8/10] vfs: shared subtree aware namespaces Ram
@ 2005-09-20  7:31 ` Al Viro
  0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2005-09-20  7:31 UTC (permalink / raw)
  To: Ram; +Cc: linux-kernel, linux-fsdevel, akpm, miklos, mike, bfields, serue

On Fri, Sep 16, 2005 at 11:26:20AM -0700, Ram wrote:
> Patch that help setup the correct propagation for the mounts under the new
> cloned namespace.

_definitely_ should go earlier in the series.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-20  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-16 18:26 [RFC PATCH 8/10] vfs: shared subtree aware namespaces Ram
2005-09-20  7:31 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).