diff options
-rw-r--r-- | fs/namespace.c | 8 | ||||
-rw-r--r-- | include/linux/mnt_namespace.h | 9 |
2 files changed, 7 insertions, 10 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 2dd333b0fe7f..6645846f2056 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -2246,10 +2246,14 @@ void __init mnt_init(void) | |||
2246 | init_mount_tree(); | 2246 | init_mount_tree(); |
2247 | } | 2247 | } |
2248 | 2248 | ||
2249 | void __put_mnt_ns(struct mnt_namespace *ns) | 2249 | void put_mnt_ns(struct mnt_namespace *ns) |
2250 | { | 2250 | { |
2251 | struct vfsmount *root = ns->root; | 2251 | struct vfsmount *root; |
2252 | LIST_HEAD(umount_list); | 2252 | LIST_HEAD(umount_list); |
2253 | |||
2254 | if (!atomic_dec_and_lock(&ns->count, &vfsmount_lock)) | ||
2255 | return; | ||
2256 | root = ns->root; | ||
2253 | ns->root = NULL; | 2257 | ns->root = NULL; |
2254 | spin_unlock(&vfsmount_lock); | 2258 | spin_unlock(&vfsmount_lock); |
2255 | down_write(&namespace_sem); | 2259 | down_write(&namespace_sem); |
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h index 3a059298cc19..299d11af5f79 100644 --- a/include/linux/mnt_namespace.h +++ b/include/linux/mnt_namespace.h | |||
@@ -26,14 +26,7 @@ struct fs_struct; | |||
26 | 26 | ||
27 | extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, | 27 | extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, |
28 | struct fs_struct *); | 28 | struct fs_struct *); |
29 | extern void __put_mnt_ns(struct mnt_namespace *ns); | 29 | extern void put_mnt_ns(struct mnt_namespace *ns); |
30 | |||
31 | static inline void put_mnt_ns(struct mnt_namespace *ns) | ||
32 | { | ||
33 | if (atomic_dec_and_lock(&ns->count, &vfsmount_lock)) | ||
34 | /* releases vfsmount_lock */ | ||
35 | __put_mnt_ns(ns); | ||
36 | } | ||
37 | 30 | ||
38 | static inline void exit_mnt_ns(struct task_struct *p) | 31 | static inline void exit_mnt_ns(struct task_struct *p) |
39 | { | 32 | { |