Commit faf0dceb authored by Al Viro's avatar Al Viro

Merge branch 'work.namespace' into for-linus

parents 128394ef 5235d448
...@@ -96,10 +96,6 @@ static inline struct hlist_head *mp_hash(struct dentry *dentry) ...@@ -96,10 +96,6 @@ static inline struct hlist_head *mp_hash(struct dentry *dentry)
return &mountpoint_hashtable[tmp & mp_hash_mask]; return &mountpoint_hashtable[tmp & mp_hash_mask];
} }
/*
* allocation is serialized by namespace_sem, but we need the spinlock to
* serialize with freeing.
*/
static int mnt_alloc_id(struct mount *mnt) static int mnt_alloc_id(struct mount *mnt)
{ {
int res; int res;
...@@ -1034,6 +1030,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root, ...@@ -1034,6 +1030,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
if (IS_MNT_SLAVE(old)) if (IS_MNT_SLAVE(old))
list_add(&mnt->mnt_slave, &old->mnt_slave); list_add(&mnt->mnt_slave, &old->mnt_slave);
mnt->mnt_master = old->mnt_master; mnt->mnt_master = old->mnt_master;
} else {
CLEAR_MNT_SHARED(mnt);
} }
if (flag & CL_MAKE_SHARED) if (flag & CL_MAKE_SHARED)
set_mnt_shared(mnt); set_mnt_shared(mnt);
...@@ -1828,9 +1826,7 @@ struct vfsmount *clone_private_mount(const struct path *path) ...@@ -1828,9 +1826,7 @@ struct vfsmount *clone_private_mount(const struct path *path)
if (IS_MNT_UNBINDABLE(old_mnt)) if (IS_MNT_UNBINDABLE(old_mnt))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
down_read(&namespace_sem);
new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE); new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE);
up_read(&namespace_sem);
if (IS_ERR(new_mnt)) if (IS_ERR(new_mnt))
return ERR_CAST(new_mnt); return ERR_CAST(new_mnt);
......
...@@ -67,49 +67,47 @@ int get_dominating_id(struct mount *mnt, const struct path *root) ...@@ -67,49 +67,47 @@ int get_dominating_id(struct mount *mnt, const struct path *root)
static int do_make_slave(struct mount *mnt) static int do_make_slave(struct mount *mnt)
{ {
struct mount *peer_mnt = mnt, *master = mnt->mnt_master; struct mount *master, *slave_mnt;
struct mount *slave_mnt;
/* if (list_empty(&mnt->mnt_share)) {
* slave 'mnt' to a peer mount that has the if (IS_MNT_SHARED(mnt)) {
* same root dentry. If none is available then mnt_release_group_id(mnt);
* slave it to anything that is available. CLEAR_MNT_SHARED(mnt);
*/ }
while ((peer_mnt = next_peer(peer_mnt)) != mnt && master = mnt->mnt_master;
peer_mnt->mnt.mnt_root != mnt->mnt.mnt_root) ; if (!master) {
struct list_head *p = &mnt->mnt_slave_list;
if (peer_mnt == mnt) { while (!list_empty(p)) {
peer_mnt = next_peer(mnt); slave_mnt = list_first_entry(p,
if (peer_mnt == mnt) struct mount, mnt_slave);
peer_mnt = NULL; list_del_init(&slave_mnt->mnt_slave);
} slave_mnt->mnt_master = NULL;
if (mnt->mnt_group_id && IS_MNT_SHARED(mnt) && }
list_empty(&mnt->mnt_share)) return 0;
mnt_release_group_id(mnt); }
list_del_init(&mnt->mnt_share);
mnt->mnt_group_id = 0;
if (peer_mnt)
master = peer_mnt;
if (master) {
list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
slave_mnt->mnt_master = master;
list_move(&mnt->mnt_slave, &master->mnt_slave_list);
list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
INIT_LIST_HEAD(&mnt->mnt_slave_list);
} else { } else {
struct list_head *p = &mnt->mnt_slave_list; struct mount *m;
while (!list_empty(p)) { /*
slave_mnt = list_first_entry(p, * slave 'mnt' to a peer mount that has the
struct mount, mnt_slave); * same root dentry. If none is available then
list_del_init(&slave_mnt->mnt_slave); * slave it to anything that is available.
slave_mnt->mnt_master = NULL; */
for (m = master = next_peer(mnt); m != mnt; m = next_peer(m)) {
if (m->mnt.mnt_root == mnt->mnt.mnt_root) {
master = m;
break;
}
} }
list_del_init(&mnt->mnt_share);
mnt->mnt_group_id = 0;
CLEAR_MNT_SHARED(mnt);
} }
list_for_each_entry(slave_mnt, &mnt->mnt_slave_list, mnt_slave)
slave_mnt->mnt_master = master;
list_move(&mnt->mnt_slave, &master->mnt_slave_list);
list_splice(&mnt->mnt_slave_list, master->mnt_slave_list.prev);
INIT_LIST_HEAD(&mnt->mnt_slave_list);
mnt->mnt_master = master; mnt->mnt_master = master;
CLEAR_MNT_SHARED(mnt);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment