linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] namespace.c: fix bind mount from foreign namespace
@ 2005-05-13 10:44 Miklos Szeredi
  2005-05-13 16:49 ` Ram
  2005-05-13 17:06 ` Al Viro
  0 siblings, 2 replies; 44+ messages in thread
From: Miklos Szeredi @ 2005-05-13 10:44 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, linux-fsdevel

Bind mount from a foreign namespace results in an un-removable mount.
The reason is that mnt->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->mnt_namespace to current->namespace.

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->namspace is being modified: check_mnt(nd->mnt).  So setting
mnt->mnt_namespace to current->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 <miklos@szeredi.hu>

Index: linux/fs/namespace.c
===================================================================
--- linux.orig/fs/namespace.c	2005-05-13 12:22:52.000000000 +0200
+++ linux/fs/namespace.c	2005-05-13 12:32:36.000000000 +0200
@@ -160,7 +160,7 @@ clone_mnt(struct vfsmount *old, struct d
 		mnt->mnt_root = dget(root);
 		mnt->mnt_mountpoint = mnt->mnt_root;
 		mnt->mnt_parent = mnt;
-		mnt->mnt_namespace = old->mnt_namespace;
+		mnt->mnt_namespace = current->namespace;
 
 		/* stick the duplicate mount on the same expiry list
 		 * as the original if that was on one */

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

end of thread, other threads:[~2005-05-19 12:54 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-13 10:44 [PATCH] namespace.c: fix bind mount from foreign namespace Miklos Szeredi
2005-05-13 16:49 ` Ram
2005-05-13 17:06 ` Al Viro
2005-05-13 17:17   ` Miklos Szeredi
2005-05-13 17:25     ` Al Viro
2005-05-13 17:34       ` Miklos Szeredi
2005-05-13 17:29     ` Ram
2005-05-13 18:40       ` Miklos Szeredi
     [not found]         ` <1116012287.6248.410.camel@localhost>
     [not found]           ` <E1DWfqJ-0004eP-00@dorka.pomaz.szeredi.hu>
     [not found]             ` <1116013840.6248.429.camel@localhost>
2005-05-14  6:11               ` Miklos Szeredi
2005-05-16 15:11                 ` Ram
2005-05-16  8:44                   ` Miklos Szeredi
2005-05-16  8:59                     ` Miklos Szeredi
2005-05-16 11:26                     ` Jamie Lokier
2005-05-16 13:23                       ` Miklos Szeredi
2005-05-16 11:14                   ` Jamie Lokier
2005-05-17  3:50                     ` Ram
2005-05-16 20:15                       ` Miklos Szeredi
2005-05-17  1:28                         ` Jamie Lokier
2005-05-17  5:34                           ` Miklos Szeredi
     [not found]                             ` <1116360352.24560.85.camel@localhost>
     [not found]                               ` <E1DYI0m-0000K5-00@dorka.pomaz.szeredi.hu>
     [not found]                                 ` <1116399887.24560.116.camel@localhost>
     [not found]                                   ` <1116400118.24560.119.camel@localhost>
2005-05-18  9:51                                     ` [PATCH] fix race in mark_mounts_for_expiry() Miklos Szeredi
2005-05-18 10:32                                     ` David Howells
2005-05-18 10:37                                       ` Miklos Szeredi
2005-05-18 10:46                                       ` David Howells
2005-05-18 10:53                                         ` Miklos Szeredi
2005-05-18 11:07                                           ` Trond Myklebust
2005-05-18 11:32                                             ` Miklos Szeredi
2005-05-18 12:50                                               ` Jamie Lokier
2005-05-18 13:21                                                 ` Miklos Szeredi
2005-05-18 17:34                                                   ` Jamie Lokier
2005-05-18 19:05                                                     ` Miklos Szeredi
2005-05-18 19:52                                                       ` Jamie Lokier
2005-05-19 12:41                                                         ` Miklos Szeredi
2005-05-18 10:59                                         ` David Howells
2005-05-18 11:14                                           ` Miklos Szeredi
2005-05-18 11:51                                         ` David Howells
2005-05-18 12:08                                           ` Miklos Szeredi
2005-05-18 12:33                                             ` Miklos Szeredi
2005-05-18 16:53                                               ` Miklos Szeredi
2005-05-18 18:47                                                 ` Ram
2005-05-18 19:19                                                   ` Miklos Szeredi
2005-05-18 20:35                                                     ` Ram
2005-05-19 12:52                                                       ` Miklos Szeredi
2005-05-17 18:48                         ` [PATCH] namespace.c: fix bind mount from foreign namespace Ram
2005-05-17  0:00                       ` Jamie Lokier

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).