Skip to content

Commit e4e5990

Browse files
author
Al Viro
committed
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: Al Viro <[email protected]>
1 parent adc9b5c commit e4e5990

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/namespace.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,15 +795,17 @@ static void __touch_mnt_namespace(struct mnt_namespace *ns)
795795
/*
796796
* vfsmount lock must be held for write
797797
*/
798-
static void unhash_mnt(struct mount *mnt)
798+
static struct mountpoint *unhash_mnt(struct mount *mnt)
799799
{
800+
struct mountpoint *mp;
800801
mnt->mnt_parent = mnt;
801802
mnt->mnt_mountpoint = mnt->mnt.mnt_root;
802803
list_del_init(&mnt->mnt_child);
803804
hlist_del_init_rcu(&mnt->mnt_hash);
804805
hlist_del_init(&mnt->mnt_mp_list);
805-
put_mountpoint(mnt->mnt_mp);
806+
mp = mnt->mnt_mp;
806807
mnt->mnt_mp = NULL;
808+
return mp;
807809
}
808810

809811
/*
@@ -813,7 +815,7 @@ static void detach_mnt(struct mount *mnt, struct path *old_path)
813815
{
814816
old_path->dentry = mnt->mnt_mountpoint;
815817
old_path->mnt = &mnt->mnt_parent->mnt;
816-
unhash_mnt(mnt);
818+
put_mountpoint(unhash_mnt(mnt));
817819
}
818820

819821
/*
@@ -823,7 +825,7 @@ static void umount_mnt(struct mount *mnt)
823825
{
824826
/* old mountpoint will be dropped when we can do that */
825827
mnt->mnt_ex_mountpoint = mnt->mnt_mountpoint;
826-
unhash_mnt(mnt);
828+
put_mountpoint(unhash_mnt(mnt));
827829
}
828830

829831
/*

0 commit comments

Comments
 (0)