From f4cc1c3810a0382ff76a4e119a21b90b84dbe195 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 19 Nov 2016 22:37:03 -0500 Subject: remove a bogus claim about namespace_sem being held by callers of mnt_alloc_id() Hadn't been true for quite a while Signed-off-by: Al Viro --- fs/namespace.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'fs/namespace.c') diff --git a/fs/namespace.c b/fs/namespace.c index e6c234b1a645..a1a04dd1ebfc 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -96,10 +96,6 @@ static inline struct hlist_head *mp_hash(struct dentry *dentry) 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) { int res; -- cgit v1.2.3 From 066715d3fde4834cbbec88d12ca277c4185b9303 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 19 Nov 2016 23:23:18 -0500 Subject: clone_private_mount() doesn't need to touch namespace_sem not for CL_PRIVATE clone_mnt() Signed-off-by: Al Viro --- fs/namespace.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'fs/namespace.c') diff --git a/fs/namespace.c b/fs/namespace.c index a1a04dd1ebfc..ec726ae00579 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1795,9 +1795,7 @@ struct vfsmount *clone_private_mount(struct path *path) if (IS_MNT_UNBINDABLE(old_mnt)) return ERR_PTR(-EINVAL); - down_read(&namespace_sem); new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE); - up_read(&namespace_sem); if (IS_ERR(new_mnt)) return ERR_CAST(new_mnt); -- cgit v1.2.3 From 5235d448c48e1f5a4a34bf90d412775cb75ffb32 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 20 Nov 2016 19:33:09 -0500 Subject: reorganize do_make_slave() Make sure that clone_mnt() never returns a mount with MNT_SHARED in flags, but without a valid ->mnt_group_id. That allows to demystify do_make_slave() quite a bit, among other things. Signed-off-by: Al Viro --- fs/namespace.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/namespace.c') diff --git a/fs/namespace.c b/fs/namespace.c index ec726ae00579..141d5776c70e 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1030,6 +1030,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root, if (IS_MNT_SLAVE(old)) list_add(&mnt->mnt_slave, &old->mnt_slave); mnt->mnt_master = old->mnt_master; + } else { + CLEAR_MNT_SHARED(mnt); } if (flag & CL_MAKE_SHARED) set_mnt_shared(mnt); -- cgit v1.2.3