Commit a4d70278 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Linus Torvalds

[PATCH] namespace.c: cleanup in mark_mounts_for_expiry()

This patch simplifies mark_mounts_for_expiry() by using detach_mnt() instead
of duplicating everything it does.

It should be an equivalent transformation except for righting the dput/mntput
order.

Al Viro said: "Looks sane".
Signed-off-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
Cc: <viro@parcelfarce.linux.theplanet.co.uk>
Acked-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1ce88cf4
...@@ -880,24 +880,13 @@ void mark_mounts_for_expiry(struct list_head *mounts) ...@@ -880,24 +880,13 @@ void mark_mounts_for_expiry(struct list_head *mounts)
/* check that it is still dead: the count should now be 2 - as /* check that it is still dead: the count should now be 2 - as
* contributed by the vfsmount parent and the mntget above */ * contributed by the vfsmount parent and the mntget above */
if (atomic_read(&mnt->mnt_count) == 2) { if (atomic_read(&mnt->mnt_count) == 2) {
struct vfsmount *xdmnt; struct nameidata old_nd;
struct dentry *xdentry;
/* delete from the namespace */ /* delete from the namespace */
list_del_init(&mnt->mnt_list); list_del_init(&mnt->mnt_list);
list_del_init(&mnt->mnt_child); detach_mnt(mnt, &old_nd);
list_del_init(&mnt->mnt_hash);
mnt->mnt_mountpoint->d_mounted--;
xdentry = mnt->mnt_mountpoint;
mnt->mnt_mountpoint = mnt->mnt_root;
xdmnt = mnt->mnt_parent;
mnt->mnt_parent = mnt;
spin_unlock(&vfsmount_lock); spin_unlock(&vfsmount_lock);
path_release(&old_nd);
mntput(xdmnt);
dput(xdentry);
/* now lay it to rest if this was the last ref on the /* now lay it to rest if this was the last ref on the
* superblock */ * superblock */
......
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