aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index a0d0ef1f1a48..9d17541ebafa 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -869,7 +869,7 @@ void mark_mounts_for_expiry(struct list_head *mounts)
869 /* don't do anything if the namespace is dead - all the 869 /* don't do anything if the namespace is dead - all the
870 * vfsmounts from it are going away anyway */ 870 * vfsmounts from it are going away anyway */
871 namespace = mnt->mnt_namespace; 871 namespace = mnt->mnt_namespace;
872 if (!namespace || atomic_read(&namespace->count) <= 0) 872 if (!namespace || !namespace->root)
873 continue; 873 continue;
874 get_namespace(namespace); 874 get_namespace(namespace);
875 875
@@ -1450,9 +1450,12 @@ void __init mnt_init(unsigned long mempages)
1450 1450
1451void __put_namespace(struct namespace *namespace) 1451void __put_namespace(struct namespace *namespace)
1452{ 1452{
1453 struct vfsmount *root = namespace->root;
1454 namespace->root = NULL;
1455 spin_unlock(&vfsmount_lock);
1453 down_write(&namespace->sem); 1456 down_write(&namespace->sem);
1454 spin_lock(&vfsmount_lock); 1457 spin_lock(&vfsmount_lock);
1455 umount_tree(namespace->root); 1458 umount_tree(root);
1456 spin_unlock(&vfsmount_lock); 1459 spin_unlock(&vfsmount_lock);
1457 up_write(&namespace->sem); 1460 up_write(&namespace->sem);
1458 kfree(namespace); 1461 kfree(namespace);