From 96698f6c5e669aa4ddacf99a119725f45c37fddf Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Thu, 7 Jul 2005 17:57:24 -0700 Subject: [PATCH] --- yaml --- r: 4291 b: refs/heads/master c: 1ce88cf466f7b6078b14d67d186a3d7c19dd5609 h: refs/heads/master i: 4289: 2772d0b649b001c862e245a111a4fc9978353ab6 4287: 9ae66755cc4b152456c53757dcfcc5afffa5fae8 v: v3 --- [refs] | 2 +- trunk/fs/namespace.c | 7 +++++-- trunk/include/linux/namespace.h | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index e5763b9078b0..7b11d2ce326a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 202322e6f7cd12e82b5ff0fa92bbdf517fcf0947 +refs/heads/master: 1ce88cf466f7b6078b14d67d186a3d7c19dd5609 diff --git a/trunk/fs/namespace.c b/trunk/fs/namespace.c index a0d0ef1f1a48..9d17541ebafa 100644 --- a/trunk/fs/namespace.c +++ b/trunk/fs/namespace.c @@ -869,7 +869,7 @@ void mark_mounts_for_expiry(struct list_head *mounts) /* don't do anything if the namespace is dead - all the * vfsmounts from it are going away anyway */ namespace = mnt->mnt_namespace; - if (!namespace || atomic_read(&namespace->count) <= 0) + if (!namespace || !namespace->root) continue; get_namespace(namespace); @@ -1450,9 +1450,12 @@ void __init mnt_init(unsigned long mempages) void __put_namespace(struct namespace *namespace) { + struct vfsmount *root = namespace->root; + namespace->root = NULL; + spin_unlock(&vfsmount_lock); down_write(&namespace->sem); spin_lock(&vfsmount_lock); - umount_tree(namespace->root); + umount_tree(root); spin_unlock(&vfsmount_lock); up_write(&namespace->sem); kfree(namespace); diff --git a/trunk/include/linux/namespace.h b/trunk/include/linux/namespace.h index 697991b69f9b..0e5a86f13b2f 100644 --- a/trunk/include/linux/namespace.h +++ b/trunk/include/linux/namespace.h @@ -17,7 +17,8 @@ extern void __put_namespace(struct namespace *namespace); static inline void put_namespace(struct namespace *namespace) { - if (atomic_dec_and_test(&namespace->count)) + if (atomic_dec_and_lock(&namespace->count, &vfsmount_lock)) + /* releases vfsmount_lock */ __put_namespace(namespace); }