Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346318
b: refs/heads/master
c: 7a472ef
h: refs/heads/master
v: v3
  • Loading branch information
Eric W. Biederman committed Nov 19, 2012
1 parent 1ab8fbf commit cdd4906
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 771b1371686e0a63e938ada28de020b9a0040f55
refs/heads/master: 7a472ef4be8387bc05a42e16309b02c8ca943a40
11 changes: 8 additions & 3 deletions trunk/fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
if (!mnt)
return ERR_PTR(-ENOMEM);

if (flag & (CL_SLAVE | CL_PRIVATE))
if (flag & (CL_SLAVE | CL_PRIVATE | CL_SHARED_TO_SLAVE))
mnt->mnt_group_id = 0; /* not a peer of original */
else
mnt->mnt_group_id = old->mnt_group_id;
Expand All @@ -807,7 +807,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
list_add_tail(&mnt->mnt_instance, &sb->s_mounts);
br_write_unlock(&vfsmount_lock);

if (flag & CL_SLAVE) {
if ((flag & CL_SLAVE) ||
((flag & CL_SHARED_TO_SLAVE) && IS_MNT_SHARED(old))) {
list_add(&mnt->mnt_slave, &old->mnt_slave_list);
mnt->mnt_master = old;
CLEAR_MNT_SHARED(mnt);
Expand Down Expand Up @@ -2331,14 +2332,18 @@ static struct mnt_namespace *dup_mnt_ns(struct mnt_namespace *mnt_ns,
struct mount *p, *q;
struct mount *old = mnt_ns->root;
struct mount *new;
int copy_flags;

new_ns = alloc_mnt_ns(user_ns);
if (IS_ERR(new_ns))
return new_ns;

down_write(&namespace_sem);
/* First pass: copy the tree topology */
new = copy_tree(old, old->mnt.mnt_root, CL_COPY_ALL | CL_EXPIRE);
copy_flags = CL_COPY_ALL | CL_EXPIRE;
if (user_ns != mnt_ns->user_ns)
copy_flags |= CL_SHARED_TO_SLAVE;
new = copy_tree(old, old->mnt.mnt_root, copy_flags);
if (IS_ERR(new)) {
up_write(&namespace_sem);
free_mnt_ns(new_ns);
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/pnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define CL_COPY_ALL 0x04
#define CL_MAKE_SHARED 0x08
#define CL_PRIVATE 0x10
#define CL_SHARED_TO_SLAVE 0x20

static inline void set_mnt_shared(struct mount *mnt)
{
Expand Down

0 comments on commit cdd4906

Please sign in to comment.