summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-03-22 21:19:49 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2008-04-22 05:11:09 +0200
commit1a60a280778ff90270fc7390d9ec102f713a5a29 (patch)
tree988cb5b1446ecc298aee4771b0768d777165226c
parent[PATCH] move a bunch of declarations to fs/internal.h (diff)
downloadlinux-1a60a280778ff90270fc7390d9ec102f713a5a29.tar.xz
linux-1a60a280778ff90270fc7390d9ec102f713a5a29.zip
[PATCH] lock exclusively in collect_mounts() and drop_collected_mounts()
Taking namespace_sem shared there isn't worth the trouble, especially with vfsmount ID allocation about to be added. That way we know that umount_tree(), copy_tree() and clone_mnt() are _always_ serialized by namespace_sem. umount_tree() still needs vfsmount_lock (it manipulates hash chains, among other things), but that's a separate story. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namespace.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 678f7ce060f2..af2fb3707d0a 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1091,20 +1091,20 @@ Enomem:
struct vfsmount *collect_mounts(struct vfsmount *mnt, struct dentry *dentry)
{
struct vfsmount *tree;
- down_read(&namespace_sem);
+ down_write(&namespace_sem);
tree = copy_tree(mnt, dentry, CL_COPY_ALL | CL_PRIVATE);
- up_read(&namespace_sem);
+ up_write(&namespace_sem);
return tree;
}
void drop_collected_mounts(struct vfsmount *mnt)
{
LIST_HEAD(umount_list);
- down_read(&namespace_sem);
+ down_write(&namespace_sem);
spin_lock(&vfsmount_lock);
umount_tree(mnt, 0, &umount_list);
spin_unlock(&vfsmount_lock);
- up_read(&namespace_sem);
+ up_write(&namespace_sem);
release_mounts(&umount_list);
}