Skip to content

Commit

Permalink
[PATCH] namespace.c: cleanup in mark_mounts_for_expiry()
Browse files Browse the repository at this point in the history
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: Miklos Szeredi <miklos@szeredi.hu>
Cc: <viro@parcelfarce.linux.theplanet.co.uk>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Jul 8, 2005
1 parent 1ce88cf commit a4d7027
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions fs/namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* contributed by the vfsmount parent and the mntget above */
if (atomic_read(&mnt->mnt_count) == 2) {
struct vfsmount *xdmnt;
struct dentry *xdentry;
struct nameidata old_nd;

/* delete from the namespace */
list_del_init(&mnt->mnt_list);
list_del_init(&mnt->mnt_child);
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;

detach_mnt(mnt, &old_nd);
spin_unlock(&vfsmount_lock);

mntput(xdmnt);
dput(xdentry);
path_release(&old_nd);

/* now lay it to rest if this was the last ref on the
* superblock */
Expand Down

0 comments on commit a4d7027

Please sign in to comment.