aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index a01c7730e9af..ef42d9bee212 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1217,6 +1217,11 @@ static void namespace_unlock(void)
1217 head.first->pprev = &head.first; 1217 head.first->pprev = &head.first;
1218 INIT_HLIST_HEAD(&unmounted); 1218 INIT_HLIST_HEAD(&unmounted);
1219 1219
1220 /* undo decrements we'd done in umount_tree() */
1221 hlist_for_each_entry(mnt, &head, mnt_hash)
1222 if (mnt->mnt_ex_mountpoint.mnt)
1223 mntget(mnt->mnt_ex_mountpoint.mnt);
1224
1220 up_write(&namespace_sem); 1225 up_write(&namespace_sem);
1221 1226
1222 synchronize_rcu(); 1227 synchronize_rcu();
@@ -1253,6 +1258,9 @@ void umount_tree(struct mount *mnt, int how)
1253 hlist_add_head(&p->mnt_hash, &tmp_list); 1258 hlist_add_head(&p->mnt_hash, &tmp_list);
1254 } 1259 }
1255 1260
1261 hlist_for_each_entry(p, &tmp_list, mnt_hash)
1262 list_del_init(&p->mnt_child);
1263
1256 if (how) 1264 if (how)
1257 propagate_umount(&tmp_list); 1265 propagate_umount(&tmp_list);
1258 1266
@@ -1263,9 +1271,9 @@ void umount_tree(struct mount *mnt, int how)
1263 p->mnt_ns = NULL; 1271 p->mnt_ns = NULL;
1264 if (how < 2) 1272 if (how < 2)
1265 p->mnt.mnt_flags |= MNT_SYNC_UMOUNT; 1273 p->mnt.mnt_flags |= MNT_SYNC_UMOUNT;
1266 list_del_init(&p->mnt_child);
1267 if (mnt_has_parent(p)) { 1274 if (mnt_has_parent(p)) {
1268 put_mountpoint(p->mnt_mp); 1275 put_mountpoint(p->mnt_mp);
1276 mnt_add_count(p->mnt_parent, -1);
1269 /* move the reference to mountpoint into ->mnt_ex_mountpoint */ 1277 /* move the reference to mountpoint into ->mnt_ex_mountpoint */
1270 p->mnt_ex_mountpoint.dentry = p->mnt_mountpoint; 1278 p->mnt_ex_mountpoint.dentry = p->mnt_mountpoint;
1271 p->mnt_ex_mountpoint.mnt = &p->mnt_parent->mnt; 1279 p->mnt_ex_mountpoint.mnt = &p->mnt_parent->mnt;