[PATCH v2 01/12] sunrpc: mount rpc_pipefs on initialization

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kirill A. Shutemov
Date: Wednesday, December 29, 2010 - 6:14 am

Mount rpc_pipefs on register_rpc_pipefs() and replace
rpc_get_mount()/rpc_put_mount() implementation with mntget()/mntput().

Signed-off-by: Kirill A. Shutemov <kas@openvz.org>
---
 net/sunrpc/rpc_pipe.c |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 10a17a3..7f3fbdd 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -29,7 +29,6 @@
 #include <linux/sunrpc/cache.h>
 
 static struct vfsmount *rpc_mnt __read_mostly;
-static int rpc_mount_count;
 
 static struct file_system_type rpc_pipe_fs_type;
 
@@ -415,18 +414,13 @@ struct rpc_filelist {
 
 struct vfsmount *rpc_get_mount(void)
 {
-	int err;
-
-	err = simple_pin_fs(&rpc_pipe_fs_type, &rpc_mnt, &rpc_mount_count);
-	if (err != 0)
-		return ERR_PTR(err);
-	return rpc_mnt;
+	return mntget(rpc_mnt);
 }
 EXPORT_SYMBOL_GPL(rpc_get_mount);
 
 void rpc_put_mount(void)
 {
-	simple_release_fs(&rpc_mnt, &rpc_mount_count);
+	mntput(rpc_mnt);
 }
 EXPORT_SYMBOL_GPL(rpc_put_mount);
 
@@ -1063,16 +1057,27 @@ int register_rpc_pipefs(void)
 	if (!rpc_inode_cachep)
 		return -ENOMEM;
 	err = register_filesystem(&rpc_pipe_fs_type);
-	if (err) {
-		kmem_cache_destroy(rpc_inode_cachep);
-		return err;
+	if (err)
+		goto destroy_cache;
+
+	rpc_mnt = kern_mount(&rpc_pipe_fs_type);
+	if (IS_ERR(rpc_mnt)) {
+		err = PTR_ERR(rpc_mnt);
+		goto unregister_fs;
 	}
 
 	return 0;
+
+unregister_fs:
+	unregister_filesystem(&rpc_pipe_fs_type);
+destroy_cache:
+	kmem_cache_destroy(rpc_inode_cachep);
+	return err;
 }
 
 void unregister_rpc_pipefs(void)
 {
+	mntput(rpc_mnt);
 	kmem_cache_destroy(rpc_inode_cachep);
 	unregister_filesystem(&rpc_pipe_fs_type);
 }
-- 
1.7.3.4

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v2 00/12] make rpc_pipefs be mountable multiple time, Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 01/12] sunrpc: mount rpc_pipefs on initialization, Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 03/12] sunrpc: push init_rpc_pipefs up to rpc_cr ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 05/12] sunrpc: get rpc_pipefs mount point for sv ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 06/12] lockd: get rpc_pipefs mount point from ca ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 07/12] sunrpc: get rpc_pipefs mount point for rp ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 08/12] sunrpc: tag pipefs field of cache_detail ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 09/12] nfs: per-rpc_pipefs dns cache, Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 10/12] sunrpc: introduce get_rpc_pipefs(), Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 11/12] nfs: introduce mount option 'rpcmount', Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 12/12] sunrpc: make rpc_pipefs be mountable mult ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Thu Dec 30, 1:51 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Thu Dec 30, 2:44 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Thu Dec 30, 3:44 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Thu Dec 30, 4:45 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Fri Dec 31, 6:03 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Mon Jan 3, 9:53 am)