diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2014-12-29 14:03:41 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2015-04-09 12:39:54 -0400 |
commit | 7bdb11de8ee4f4ae195e2fa19efd304e0b36c63b (patch) | |
tree | 2ee3fe90e5ac72a2b36c91947b38c3e6da9a9012 /fs/namespace.c | |
parent | cd4a40174b71acd021877341684d8bb1dc8ea4ae (diff) |
mnt: Factor out unhash_mnt from detach_mnt and umount_tree
Create a function unhash_mnt that contains the common code between
detach_mnt and umount_tree, and use unhash_mnt in place of the common
code. This add a unncessary list_del_init(mnt->mnt_child) into
umount_tree but given that mnt_child is already empty this extra
line is a noop.
Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index acc5583764dc..e669a3bf86e7 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -798,10 +798,8 @@ static void __touch_mnt_namespace(struct mnt_namespace *ns) | |||
798 | /* | 798 | /* |
799 | * vfsmount lock must be held for write | 799 | * vfsmount lock must be held for write |
800 | */ | 800 | */ |
801 | static void detach_mnt(struct mount *mnt, struct path *old_path) | 801 | static void unhash_mnt(struct mount *mnt) |
802 | { | 802 | { |
803 | old_path->dentry = mnt->mnt_mountpoint; | ||
804 | old_path->mnt = &mnt->mnt_parent->mnt; | ||
805 | mnt->mnt_parent = mnt; | 803 | mnt->mnt_parent = mnt; |
806 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; | 804 | mnt->mnt_mountpoint = mnt->mnt.mnt_root; |
807 | list_del_init(&mnt->mnt_child); | 805 | list_del_init(&mnt->mnt_child); |
@@ -814,6 +812,16 @@ static void detach_mnt(struct mount *mnt, struct path *old_path) | |||
814 | /* | 812 | /* |
815 | * vfsmount lock must be held for write | 813 | * vfsmount lock must be held for write |
816 | */ | 814 | */ |
815 | static void detach_mnt(struct mount *mnt, struct path *old_path) | ||
816 | { | ||
817 | old_path->dentry = mnt->mnt_mountpoint; | ||
818 | old_path->mnt = &mnt->mnt_parent->mnt; | ||
819 | unhash_mnt(mnt); | ||
820 | } | ||
821 | |||
822 | /* | ||
823 | * vfsmount lock must be held for write | ||
824 | */ | ||
817 | void mnt_set_mountpoint(struct mount *mnt, | 825 | void mnt_set_mountpoint(struct mount *mnt, |
818 | struct mountpoint *mp, | 826 | struct mountpoint *mp, |
819 | struct mount *child_mnt) | 827 | struct mount *child_mnt) |
@@ -1362,15 +1370,10 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how) | |||
1362 | 1370 | ||
1363 | pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted); | 1371 | pin_insert_group(&p->mnt_umount, &p->mnt_parent->mnt, &unmounted); |
1364 | if (mnt_has_parent(p)) { | 1372 | if (mnt_has_parent(p)) { |
1365 | hlist_del_init(&p->mnt_mp_list); | ||
1366 | put_mountpoint(p->mnt_mp); | ||
1367 | mnt_add_count(p->mnt_parent, -1); | 1373 | mnt_add_count(p->mnt_parent, -1); |
1368 | /* old mountpoint will be dropped when we can do that */ | 1374 | /* old mountpoint will be dropped when we can do that */ |
1369 | p->mnt_ex_mountpoint = p->mnt_mountpoint; | 1375 | p->mnt_ex_mountpoint = p->mnt_mountpoint; |
1370 | p->mnt_mountpoint = p->mnt.mnt_root; | 1376 | unhash_mnt(p); |
1371 | p->mnt_parent = p; | ||
1372 | p->mnt_mp = NULL; | ||
1373 | hlist_del_init_rcu(&p->mnt_hash); | ||
1374 | } | 1377 | } |
1375 | change_mnt_propagation(p, MS_PRIVATE); | 1378 | change_mnt_propagation(p, MS_PRIVATE); |
1376 | } | 1379 | } |