浏览代码

VFS: Uninline the function put_mnt_ns()

In order to allow modules to use it without having to export vfsmount_lock.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Trond Myklebust 16 年之前
父节点
当前提交
616511d039
共有 2 个文件被更改,包括 7 次插入10 次删除
  1. 6 2
      fs/namespace.c
  2. 1 8
      include/linux/mnt_namespace.h

+ 6 - 2
fs/namespace.c

@@ -2246,10 +2246,14 @@ void __init mnt_init(void)
 	init_mount_tree();
 	init_mount_tree();
 }
 }
 
 
-void __put_mnt_ns(struct mnt_namespace *ns)
+void put_mnt_ns(struct mnt_namespace *ns)
 {
 {
-	struct vfsmount *root = ns->root;
+	struct vfsmount *root;
 	LIST_HEAD(umount_list);
 	LIST_HEAD(umount_list);
+
+	if (!atomic_dec_and_lock(&ns->count, &vfsmount_lock))
+		return;
+	root = ns->root;
 	ns->root = NULL;
 	ns->root = NULL;
 	spin_unlock(&vfsmount_lock);
 	spin_unlock(&vfsmount_lock);
 	down_write(&namespace_sem);
 	down_write(&namespace_sem);

+ 1 - 8
include/linux/mnt_namespace.h

@@ -26,14 +26,7 @@ struct fs_struct;
 
 
 extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
 extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
 		struct fs_struct *);
 		struct fs_struct *);
-extern void __put_mnt_ns(struct mnt_namespace *ns);
-
-static inline void put_mnt_ns(struct mnt_namespace *ns)
-{
-	if (atomic_dec_and_lock(&ns->count, &vfsmount_lock))
-		/* releases vfsmount_lock */
-		__put_mnt_ns(ns);
-}
+extern void put_mnt_ns(struct mnt_namespace *ns);
 
 
 static inline void exit_mnt_ns(struct task_struct *p)
 static inline void exit_mnt_ns(struct task_struct *p)
 {
 {