Skip to content

Commit

Permalink
[PATCH] lock exclusively in collect_mounts() and drop_collected_mounts()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Al Viro committed Apr 22, 2008
1 parent 6d59e7f commit 1a60a28
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,20 +1091,20 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
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);
}

Expand Down

0 comments on commit 1a60a28

Please sign in to comment.