Commit e4e59906 authored by Al Viro's avatar Al Viro

fs/namespace.c: shift put_mountpoint() to callers of unhash_mnt()

make unhash_mnt() return the mountpoint to be dropped, let callers
deal with it.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent adc9b5c0
...@@ -795,15 +795,17 @@ static void __touch_mnt_namespace(struct mnt_namespace *ns) ...@@ -795,15 +795,17 @@ static void __touch_mnt_namespace(struct mnt_namespace *ns)
/* /*
* vfsmount lock must be held for write * vfsmount lock must be held for write
*/ */
static void unhash_mnt(struct mount *mnt) static struct mountpoint *unhash_mnt(struct mount *mnt)
{ {
struct mountpoint *mp;
mnt->mnt_parent = mnt; mnt->mnt_parent = mnt;
mnt->mnt_mountpoint = mnt->mnt.mnt_root; mnt->mnt_mountpoint = mnt->mnt.mnt_root;
list_del_init(&mnt->mnt_child); list_del_init(&mnt->mnt_child);
hlist_del_init_rcu(&mnt->mnt_hash); hlist_del_init_rcu(&mnt->mnt_hash);
hlist_del_init(&mnt->mnt_mp_list); hlist_del_init(&mnt->mnt_mp_list);
put_mountpoint(mnt->mnt_mp); mp = mnt->mnt_mp;
mnt->mnt_mp = NULL; mnt->mnt_mp = NULL;
return mp;
} }
/* /*
...@@ -813,7 +815,7 @@ static void detach_mnt(struct mount *mnt, struct path *old_path) ...@@ -813,7 +815,7 @@ static void detach_mnt(struct mount *mnt, struct path *old_path)
{ {
old_path->dentry = mnt->mnt_mountpoint; old_path->dentry = mnt->mnt_mountpoint;
old_path->mnt = &mnt->mnt_parent->mnt; old_path->mnt = &mnt->mnt_parent->mnt;
unhash_mnt(mnt); put_mountpoint(unhash_mnt(mnt));
} }
/* /*
...@@ -823,7 +825,7 @@ static void umount_mnt(struct mount *mnt) ...@@ -823,7 +825,7 @@ static void umount_mnt(struct mount *mnt)
{ {
/* old mountpoint will be dropped when we can do that */ /* old mountpoint will be dropped when we can do that */
mnt->mnt_ex_mountpoint = mnt->mnt_mountpoint; mnt->mnt_ex_mountpoint = mnt->mnt_mountpoint;
unhash_mnt(mnt); put_mountpoint(unhash_mnt(mnt));
} }
/* /*
......
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