mnt: Factor umount_mnt from umount_tree
For future use factor out a function umount_mnt from umount_tree. This function unhashes a mount and remembers where the mount was mounted so that eventually when the code makes it to a sleeping context the mountpoint can be dput. Cc: stable@vger.kernel.org Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
parent
7bdb11de8e
commit
6a46c5735c
1 changed files with 11 additions and 3 deletions
|
@ -819,6 +819,16 @@ static void detach_mnt(struct mount *mnt, struct path *old_path)
|
||||||
unhash_mnt(mnt);
|
unhash_mnt(mnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* vfsmount lock must be held for write
|
||||||
|
*/
|
||||||
|
static void umount_mnt(struct mount *mnt)
|
||||||
|
{
|
||||||
|
/* old mountpoint will be dropped when we can do that */
|
||||||
|
mnt->mnt_ex_mountpoint = mnt->mnt_mountpoint;
|
||||||
|
unhash_mnt(mnt);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* vfsmount lock must be held for write
|
* vfsmount lock must be held for write
|
||||||
*/
|
*/
|
||||||
|
@ -1371,9 +1381,7 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how)
|
||||||
pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted);
|
pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted);
|
||||||
if (mnt_has_parent(p)) {
|
if (mnt_has_parent(p)) {
|
||||||
mnt_add_count(p->mnt_parent, -1);
|
mnt_add_count(p->mnt_parent, -1);
|
||||||
/* old mountpoint will be dropped when we can do that */
|
umount_mnt(p);
|
||||||
p->mnt_ex_mountpoint = p->mnt_mountpoint;
|
|
||||||
unhash_mnt(p);
|
|
||||||
}
|
}
|
||||||
change_mnt_propagation(p, MS_PRIVATE);
|
change_mnt_propagation(p, MS_PRIVATE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue