<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Miklos Szeredi &lt;miklos@szeredi.hu&gt;

I'm resending this patch, because I still believe it's the correct fix.

Tested before/after applying the patch with a test application
available from:

  http://www.inf.bme.hu/~mszeredi/nstest.c

Bind mount from a foreign namespace results in an un-removable mount.
The reason is that mnt-&gt;mnt_namespace is copied from the old mount in
clone_mnt().  Because of this check_mnt() in sys_umount() will fail.

The solution is to set mnt-&gt;mnt_namespace to current-&gt;namespace in
clone_mnt().  clone_mnt() is either called from do_loopback() or
copy_tree().  copy_tree() is called from do_loopback() or
copy_namespace().

When called (directly or indirectly) from do_loopback(), always
current-&gt;namspace is being modified: check_mnt(nd-&gt;mnt).  So setting
mnt-&gt;mnt_namespace to current-&gt;namspace is the right thing to do.

When called from copy_namespace(), the setting of mnt_namespace is
irrelevant, since mnt_namespace is reset later in that function for
all copied mounts.

Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 fs/namespace.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN fs/namespace.c~namespacec-fix-bind-mount-from-foreign-namespace fs/namespace.c
--- 25/fs/namespace.c~namespacec-fix-bind-mount-from-foreign-namespace	Mon May 16 14:56:25 2005
+++ 25-akpm/fs/namespace.c	Mon May 16 14:56:25 2005
@@ -160,7 +160,7 @@ clone_mnt(struct vfsmount *old, struct d
 		mnt-&gt;mnt_root = dget(root);
 		mnt-&gt;mnt_mountpoint = mnt-&gt;mnt_root;
 		mnt-&gt;mnt_parent = mnt;
-		mnt-&gt;mnt_namespace = old-&gt;mnt_namespace;
+		mnt-&gt;mnt_namespace = current-&gt;namespace;
 
 		/* stick the duplicate mount on the same expiry list
 		 * as the original if that was on one */
_
</pre></body></html>