diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-03-22 16:19:49 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-04-21 23:11:09 -0400 |
commit | 1a60a280778ff90270fc7390d9ec102f713a5a29 (patch) | |
tree | 988cb5b1446ecc298aee4771b0768d777165226c | |
parent | 6d59e7f582ef1c1988542d0fc3b36d0087b757ce (diff) |
[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.c | 8 |
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: | |||
1091 | struct vfsmount *collect_mounts(struct vfsmount *mnt, struct dentry *dentry) | 1091 | struct vfsmount *collect_mounts(struct vfsmount *mnt, struct dentry *dentry) |
1092 | { | 1092 | { |
1093 | struct vfsmount *tree; | 1093 | struct vfsmount *tree; |
1094 | down_read(&namespace_sem); | 1094 | down_write(&namespace_sem); |
1095 | tree = copy_tree(mnt, dentry, CL_COPY_ALL | CL_PRIVATE); | 1095 | tree = copy_tree(mnt, dentry, CL_COPY_ALL | CL_PRIVATE); |
1096 | up_read(&namespace_sem); | 1096 | up_write(&namespace_sem); |
1097 | return tree; | 1097 | return tree; |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | void drop_collected_mounts(struct vfsmount *mnt) | 1100 | void drop_collected_mounts(struct vfsmount *mnt) |
1101 | { | 1101 | { |
1102 | LIST_HEAD(umount_list); | 1102 | LIST_HEAD(umount_list); |
1103 | down_read(&namespace_sem); | 1103 | down_write(&namespace_sem); |
1104 | spin_lock(&vfsmount_lock); | 1104 | spin_lock(&vfsmount_lock); |
1105 | umount_tree(mnt, 0, &umount_list); | 1105 | umount_tree(mnt, 0, &umount_list); |
1106 | spin_unlock(&vfsmount_lock); | 1106 | spin_unlock(&vfsmount_lock); |
1107 | up_read(&namespace_sem); | 1107 | up_write(&namespace_sem); |
1108 | release_mounts(&umount_list); | 1108 | release_mounts(&umount_list); |
1109 | } | 1109 | } |
1110 | 1110 | ||